diff options
Renamed Region/CoreModules/ServiceConnectors to Region/CoreModules/ServiceConnectorsOut. No functional changes.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectors')
12 files changed, 0 insertions, 3285 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs deleted file mode 100644 index 4025fa6..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/HGAssetBroker.cs +++ /dev/null | |||
@@ -1,343 +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 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Server.Base; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenMetaverse; | ||
39 | |||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | ||
41 | { | ||
42 | public class HGAssetBroker : | ||
43 | ISharedRegionModule, IAssetService | ||
44 | { | ||
45 | private static readonly ILog m_log = | ||
46 | LogManager.GetLogger( | ||
47 | MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private IImprovedAssetCache m_Cache = null; | ||
50 | private IAssetService m_GridService; | ||
51 | private IAssetService m_HGService; | ||
52 | |||
53 | private bool m_Enabled = false; | ||
54 | |||
55 | public string Name | ||
56 | { | ||
57 | get { return "HGAssetBroker"; } | ||
58 | } | ||
59 | |||
60 | public void Initialise(IConfigSource source) | ||
61 | { | ||
62 | IConfig moduleConfig = source.Configs["Modules"]; | ||
63 | if (moduleConfig != null) | ||
64 | { | ||
65 | string name = moduleConfig.GetString("AssetServices", ""); | ||
66 | if (name == Name) | ||
67 | { | ||
68 | IConfig assetConfig = source.Configs["AssetService"]; | ||
69 | if (assetConfig == null) | ||
70 | { | ||
71 | m_log.Error("[HG ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); | ||
72 | return; | ||
73 | } | ||
74 | |||
75 | string localDll = assetConfig.GetString("LocalGridAssetService", | ||
76 | String.Empty); | ||
77 | string HGDll = assetConfig.GetString("HypergridAssetService", | ||
78 | String.Empty); | ||
79 | |||
80 | if (localDll == String.Empty) | ||
81 | { | ||
82 | m_log.Error("[HG ASSET CONNECTOR]: No LocalGridAssetService named in section AssetService"); | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | if (HGDll == String.Empty) | ||
87 | { | ||
88 | m_log.Error("[HG ASSET CONNECTOR]: No HypergridAssetService named in section AssetService"); | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | Object[] args = new Object[] { source }; | ||
93 | m_GridService = | ||
94 | ServerUtils.LoadPlugin<IAssetService>(localDll, | ||
95 | args); | ||
96 | |||
97 | m_HGService = | ||
98 | ServerUtils.LoadPlugin<IAssetService>(HGDll, | ||
99 | args); | ||
100 | |||
101 | if (m_GridService == null) | ||
102 | { | ||
103 | m_log.Error("[HG ASSET CONNECTOR]: Can't load local asset service"); | ||
104 | return; | ||
105 | } | ||
106 | if (m_HGService == null) | ||
107 | { | ||
108 | m_log.Error("[HG ASSET CONNECTOR]: Can't load hypergrid asset service"); | ||
109 | return; | ||
110 | } | ||
111 | |||
112 | m_Enabled = true; | ||
113 | m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled"); | ||
114 | } | ||
115 | } | ||
116 | } | ||
117 | |||
118 | public void PostInitialise() | ||
119 | { | ||
120 | } | ||
121 | |||
122 | public void Close() | ||
123 | { | ||
124 | } | ||
125 | |||
126 | public void AddRegion(Scene scene) | ||
127 | { | ||
128 | if (!m_Enabled) | ||
129 | return; | ||
130 | |||
131 | scene.RegisterModuleInterface<IAssetService>(this); | ||
132 | } | ||
133 | |||
134 | public void RemoveRegion(Scene scene) | ||
135 | { | ||
136 | } | ||
137 | |||
138 | public void RegionLoaded(Scene scene) | ||
139 | { | ||
140 | if (!m_Enabled) | ||
141 | return; | ||
142 | |||
143 | if (m_Cache == null) | ||
144 | { | ||
145 | m_Cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
146 | |||
147 | if (!(m_Cache is ISharedRegionModule)) | ||
148 | m_Cache = null; | ||
149 | } | ||
150 | |||
151 | m_log.InfoFormat("[HG ASSET CONNECTOR]: Enabled hypergrid asset broker for region {0}", scene.RegionInfo.RegionName); | ||
152 | |||
153 | if (m_Cache != null) | ||
154 | { | ||
155 | m_log.InfoFormat("[HG ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); | ||
156 | } | ||
157 | } | ||
158 | |||
159 | private bool IsHG(string id) | ||
160 | { | ||
161 | Uri assetUri; | ||
162 | |||
163 | if (Uri.TryCreate(id, UriKind.Absolute, out assetUri) && | ||
164 | assetUri.Scheme == Uri.UriSchemeHttp) | ||
165 | return true; | ||
166 | |||
167 | return false; | ||
168 | } | ||
169 | |||
170 | public AssetBase Get(string id) | ||
171 | { | ||
172 | //m_log.DebugFormat("[HG ASSET CONNECTOR]: Get {0}", id); | ||
173 | AssetBase asset = null; | ||
174 | |||
175 | if (m_Cache != null) | ||
176 | { | ||
177 | asset = m_Cache.Get(id); | ||
178 | |||
179 | if (asset != null) | ||
180 | return asset; | ||
181 | } | ||
182 | |||
183 | if (IsHG(id)) | ||
184 | { | ||
185 | asset = m_HGService.Get(id); | ||
186 | if (asset != null) | ||
187 | { | ||
188 | // Now store it locally | ||
189 | // For now, let me just do it for textures and scripts | ||
190 | if (((AssetType)asset.Type == AssetType.Texture) || | ||
191 | ((AssetType)asset.Type == AssetType.LSLBytecode) || | ||
192 | ((AssetType)asset.Type == AssetType.LSLText)) | ||
193 | { | ||
194 | m_GridService.Store(asset); | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | else | ||
199 | asset = m_GridService.Get(id); | ||
200 | |||
201 | if (asset != null) | ||
202 | { | ||
203 | if (m_Cache != null) | ||
204 | m_Cache.Cache(asset); | ||
205 | } | ||
206 | |||
207 | return asset; | ||
208 | } | ||
209 | |||
210 | public AssetMetadata GetMetadata(string id) | ||
211 | { | ||
212 | AssetBase asset = null; | ||
213 | |||
214 | if (m_Cache != null) | ||
215 | { | ||
216 | if (m_Cache != null) | ||
217 | m_Cache.Get(id); | ||
218 | |||
219 | if (asset != null) | ||
220 | return asset.Metadata; | ||
221 | } | ||
222 | |||
223 | AssetMetadata metadata; | ||
224 | |||
225 | if (IsHG(id)) | ||
226 | metadata = m_HGService.GetMetadata(id); | ||
227 | else | ||
228 | metadata = m_GridService.GetMetadata(id); | ||
229 | |||
230 | return metadata; | ||
231 | } | ||
232 | |||
233 | public byte[] GetData(string id) | ||
234 | { | ||
235 | AssetBase asset = null; | ||
236 | |||
237 | if (m_Cache != null) | ||
238 | { | ||
239 | if (m_Cache != null) | ||
240 | m_Cache.Get(id); | ||
241 | |||
242 | if (asset != null) | ||
243 | return asset.Data; | ||
244 | } | ||
245 | |||
246 | if (IsHG(id)) | ||
247 | asset = m_HGService.Get(id); | ||
248 | else | ||
249 | asset = m_GridService.Get(id); | ||
250 | |||
251 | if (asset != null) | ||
252 | { | ||
253 | if (m_Cache != null) | ||
254 | m_Cache.Cache(asset); | ||
255 | return asset.Data; | ||
256 | } | ||
257 | |||
258 | return null; | ||
259 | } | ||
260 | |||
261 | public bool Get(string id, Object sender, AssetRetrieved handler) | ||
262 | { | ||
263 | AssetBase asset = null; | ||
264 | |||
265 | if (m_Cache != null) | ||
266 | asset = m_Cache.Get(id); | ||
267 | |||
268 | if (asset != null) | ||
269 | { | ||
270 | handler.BeginInvoke(id, sender, asset, null, null); | ||
271 | return true; | ||
272 | } | ||
273 | |||
274 | if (IsHG(id)) | ||
275 | { | ||
276 | return m_HGService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) | ||
277 | { | ||
278 | if (a != null && m_Cache != null) | ||
279 | m_Cache.Cache(a); | ||
280 | handler(assetID, s, a); | ||
281 | }); | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | return m_GridService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) | ||
286 | { | ||
287 | if (a != null && m_Cache != null) | ||
288 | m_Cache.Cache(a); | ||
289 | handler(assetID, s, a); | ||
290 | }); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | public string Store(AssetBase asset) | ||
295 | { | ||
296 | bool isHG = IsHG(asset.ID); | ||
297 | |||
298 | if ((m_Cache != null) && !isHG) | ||
299 | // Don't store it in the cache if the asset is to | ||
300 | // be sent to the other grid, because this is already | ||
301 | // a copy of the local asset. | ||
302 | m_Cache.Cache(asset); | ||
303 | |||
304 | if (asset.Temporary || asset.Local) | ||
305 | return asset.ID; | ||
306 | |||
307 | if (IsHG(asset.ID)) | ||
308 | return m_HGService.Store(asset); | ||
309 | else | ||
310 | return m_GridService.Store(asset); | ||
311 | } | ||
312 | |||
313 | public bool UpdateContent(string id, byte[] data) | ||
314 | { | ||
315 | AssetBase asset = null; | ||
316 | |||
317 | if (m_Cache != null) | ||
318 | asset = m_Cache.Get(id); | ||
319 | |||
320 | if (asset != null) | ||
321 | { | ||
322 | asset.Data = data; | ||
323 | m_Cache.Cache(asset); | ||
324 | } | ||
325 | |||
326 | if (IsHG(id)) | ||
327 | return m_HGService.UpdateContent(id, data); | ||
328 | else | ||
329 | return m_GridService.UpdateContent(id, data); | ||
330 | } | ||
331 | |||
332 | public bool Delete(string id) | ||
333 | { | ||
334 | if (m_Cache != null) | ||
335 | m_Cache.Expire(id); | ||
336 | |||
337 | if (IsHG(id)) | ||
338 | return m_HGService.Delete(id); | ||
339 | else | ||
340 | return m_GridService.Delete(id); | ||
341 | } | ||
342 | } | ||
343 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs deleted file mode 100644 index 8f390ad..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs +++ /dev/null | |||
@@ -1,256 +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 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Server.Base; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | |||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | ||
40 | { | ||
41 | public class LocalAssetServicesConnector : | ||
42 | ISharedRegionModule, IAssetService | ||
43 | { | ||
44 | private static readonly ILog m_log = | ||
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private IImprovedAssetCache m_Cache = null; | ||
49 | |||
50 | private IAssetService m_AssetService; | ||
51 | |||
52 | private bool m_Enabled = false; | ||
53 | |||
54 | public string Name | ||
55 | { | ||
56 | get { return "LocalAssetServicesConnector"; } | ||
57 | } | ||
58 | |||
59 | public void Initialise(IConfigSource source) | ||
60 | { | ||
61 | IConfig moduleConfig = source.Configs["Modules"]; | ||
62 | if (moduleConfig != null) | ||
63 | { | ||
64 | string name = moduleConfig.GetString("AssetServices", ""); | ||
65 | if (name == Name) | ||
66 | { | ||
67 | IConfig assetConfig = source.Configs["AssetService"]; | ||
68 | if (assetConfig == null) | ||
69 | { | ||
70 | m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); | ||
71 | return; | ||
72 | } | ||
73 | |||
74 | string serviceDll = assetConfig.GetString("LocalServiceModule", | ||
75 | String.Empty); | ||
76 | |||
77 | if (serviceDll == String.Empty) | ||
78 | { | ||
79 | m_log.Error("[ASSET CONNECTOR]: No LocalServiceModule named in section AssetService"); | ||
80 | return; | ||
81 | } | ||
82 | |||
83 | Object[] args = new Object[] { source }; | ||
84 | m_AssetService = | ||
85 | ServerUtils.LoadPlugin<IAssetService>(serviceDll, | ||
86 | args); | ||
87 | |||
88 | if (m_AssetService == null) | ||
89 | { | ||
90 | m_log.Error("[ASSET CONNECTOR]: Can't load asset service"); | ||
91 | return; | ||
92 | } | ||
93 | m_Enabled = true; | ||
94 | m_log.Info("[ASSET CONNECTOR]: Local asset connector enabled"); | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | |||
99 | public void PostInitialise() | ||
100 | { | ||
101 | } | ||
102 | |||
103 | public void Close() | ||
104 | { | ||
105 | } | ||
106 | |||
107 | public void AddRegion(Scene scene) | ||
108 | { | ||
109 | if (!m_Enabled) | ||
110 | return; | ||
111 | |||
112 | scene.RegisterModuleInterface<IAssetService>(this); | ||
113 | } | ||
114 | |||
115 | public void RemoveRegion(Scene scene) | ||
116 | { | ||
117 | } | ||
118 | |||
119 | public void RegionLoaded(Scene scene) | ||
120 | { | ||
121 | if (!m_Enabled) | ||
122 | return; | ||
123 | |||
124 | if (m_Cache == null) | ||
125 | { | ||
126 | m_Cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
127 | |||
128 | if (!(m_Cache is ISharedRegionModule)) | ||
129 | m_Cache = null; | ||
130 | } | ||
131 | |||
132 | m_log.InfoFormat("[ASSET CONNECTOR]: Enabled local assets for region {0}", scene.RegionInfo.RegionName); | ||
133 | |||
134 | if (m_Cache != null) | ||
135 | { | ||
136 | m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); | ||
137 | } | ||
138 | else | ||
139 | { | ||
140 | // Short-circuit directly to storage layer | ||
141 | // | ||
142 | scene.UnregisterModuleInterface<IAssetService>(this); | ||
143 | scene.RegisterModuleInterface<IAssetService>(m_AssetService); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | public AssetBase Get(string id) | ||
148 | { | ||
149 | AssetBase asset = null; | ||
150 | if (m_Cache != null) | ||
151 | asset = m_Cache.Get(id); | ||
152 | |||
153 | if (asset == null) | ||
154 | { | ||
155 | asset = m_AssetService.Get(id); | ||
156 | if ((m_Cache != null) && (asset != null)) | ||
157 | m_Cache.Cache(asset); | ||
158 | } | ||
159 | return asset; | ||
160 | } | ||
161 | |||
162 | public AssetMetadata GetMetadata(string id) | ||
163 | { | ||
164 | AssetBase asset = null; | ||
165 | if (m_Cache != null) | ||
166 | asset = m_Cache.Get(id); | ||
167 | |||
168 | if (asset != null) | ||
169 | return asset.Metadata; | ||
170 | |||
171 | asset = m_AssetService.Get(id); | ||
172 | if (asset != null) | ||
173 | { | ||
174 | if (m_Cache != null) | ||
175 | m_Cache.Cache(asset); | ||
176 | return asset.Metadata; | ||
177 | } | ||
178 | |||
179 | return null; | ||
180 | } | ||
181 | |||
182 | public byte[] GetData(string id) | ||
183 | { | ||
184 | AssetBase asset = m_Cache.Get(id); | ||
185 | |||
186 | if (asset != null) | ||
187 | return asset.Data; | ||
188 | |||
189 | asset = m_AssetService.Get(id); | ||
190 | if (asset != null) | ||
191 | { | ||
192 | if (m_Cache != null) | ||
193 | m_Cache.Cache(asset); | ||
194 | return asset.Data; | ||
195 | } | ||
196 | |||
197 | return null; | ||
198 | } | ||
199 | |||
200 | public bool Get(string id, Object sender, AssetRetrieved handler) | ||
201 | { | ||
202 | AssetBase asset = null; | ||
203 | |||
204 | if (m_Cache != null) | ||
205 | m_Cache.Get(id); | ||
206 | |||
207 | if (asset != null) | ||
208 | { | ||
209 | handler.BeginInvoke(id, sender, asset, null, null); | ||
210 | return true; | ||
211 | } | ||
212 | |||
213 | return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) | ||
214 | { | ||
215 | if ((a != null) && (m_Cache != null)) | ||
216 | m_Cache.Cache(a); | ||
217 | |||
218 | handler.BeginInvoke(assetID, s, a, null, null); | ||
219 | }); | ||
220 | } | ||
221 | |||
222 | public string Store(AssetBase asset) | ||
223 | { | ||
224 | if (m_Cache != null) | ||
225 | m_Cache.Cache(asset); | ||
226 | |||
227 | if (asset.Temporary || asset.Local) | ||
228 | return asset.ID; | ||
229 | |||
230 | return m_AssetService.Store(asset); | ||
231 | } | ||
232 | |||
233 | public bool UpdateContent(string id, byte[] data) | ||
234 | { | ||
235 | AssetBase asset = null; | ||
236 | if (m_Cache != null) | ||
237 | m_Cache.Get(id); | ||
238 | if (asset != null) | ||
239 | { | ||
240 | asset.Data = data; | ||
241 | if (m_Cache != null) | ||
242 | m_Cache.Cache(asset); | ||
243 | } | ||
244 | |||
245 | return m_AssetService.UpdateContent(id, data); | ||
246 | } | ||
247 | |||
248 | public bool Delete(string id) | ||
249 | { | ||
250 | if (m_Cache != null) | ||
251 | m_Cache.Expire(id); | ||
252 | |||
253 | return m_AssetService.Delete(id); | ||
254 | } | ||
255 | } | ||
256 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs deleted file mode 100644 index d6e5ea2..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs +++ /dev/null | |||
@@ -1,127 +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 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Services.Connectors; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | |||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | ||
40 | { | ||
41 | public class RemoteAssetServicesConnector : | ||
42 | AssetServicesConnector, ISharedRegionModule, IAssetService | ||
43 | { | ||
44 | private static readonly ILog m_log = | ||
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private bool m_Enabled = false; | ||
49 | private IImprovedAssetCache m_Cache; | ||
50 | |||
51 | public string Name | ||
52 | { | ||
53 | get { return "RemoteAssetServicesConnector"; } | ||
54 | } | ||
55 | |||
56 | public override void Initialise(IConfigSource source) | ||
57 | { | ||
58 | IConfig moduleConfig = source.Configs["Modules"]; | ||
59 | if (moduleConfig != null) | ||
60 | { | ||
61 | string name = moduleConfig.GetString("AssetServices", ""); | ||
62 | if (name == Name) | ||
63 | { | ||
64 | IConfig assetConfig = source.Configs["AssetService"]; | ||
65 | if (assetConfig == null) | ||
66 | { | ||
67 | m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpanSim.ini"); | ||
68 | return; | ||
69 | } | ||
70 | |||
71 | m_Enabled = true; | ||
72 | |||
73 | base.Initialise(source); | ||
74 | |||
75 | m_log.Info("[ASSET CONNECTOR]: Remote assets enabled"); | ||
76 | } | ||
77 | } | ||
78 | } | ||
79 | |||
80 | public void PostInitialise() | ||
81 | { | ||
82 | } | ||
83 | |||
84 | public void Close() | ||
85 | { | ||
86 | } | ||
87 | |||
88 | public void AddRegion(Scene scene) | ||
89 | { | ||
90 | if (!m_Enabled) | ||
91 | return; | ||
92 | |||
93 | scene.RegisterModuleInterface<IAssetService>(this); | ||
94 | } | ||
95 | |||
96 | public void RemoveRegion(Scene scene) | ||
97 | { | ||
98 | } | ||
99 | |||
100 | public void RegionLoaded(Scene scene) | ||
101 | { | ||
102 | if (!m_Enabled) | ||
103 | return; | ||
104 | |||
105 | if (m_Cache == null) | ||
106 | { | ||
107 | m_Cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | ||
108 | |||
109 | // Since we are a shared module and scene data is not | ||
110 | // available for every method, the cache must be shared, too | ||
111 | // | ||
112 | if (!(m_Cache is ISharedRegionModule)) | ||
113 | m_Cache = null; | ||
114 | else | ||
115 | SetCache(m_Cache); | ||
116 | |||
117 | } | ||
118 | |||
119 | m_log.InfoFormat("[ASSET CONNECTOR]: Enabled remote assets for region {0}", scene.RegionInfo.RegionName); | ||
120 | |||
121 | if (m_Cache != null) | ||
122 | { | ||
123 | m_log.InfoFormat("[ASSET CONNECTOR]: Enabled asset caching for region {0}", scene.RegionInfo.RegionName); | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/LocalInterregionComms.cs deleted file mode 100644 index d2af2db..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/LocalInterregionComms.cs +++ /dev/null | |||
@@ -1,286 +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 | using System; | ||
28 | using System.Collections.Generic; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using Nini.Config; | ||
32 | using OpenMetaverse; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Region.Framework.Interfaces; | ||
35 | using OpenSim.Region.Framework.Scenes; | ||
36 | |||
37 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion | ||
38 | { | ||
39 | public class LocalInterregionComms : IRegionModule, IInterregionCommsOut, IInterregionCommsIn | ||
40 | { | ||
41 | private bool m_enabled = false; | ||
42 | |||
43 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | private List<Scene> m_sceneList = new List<Scene>(); | ||
45 | |||
46 | #region Events | ||
47 | public event ChildAgentUpdateReceived OnChildAgentUpdate; | ||
48 | |||
49 | #endregion /* Events */ | ||
50 | |||
51 | #region IRegionModule | ||
52 | |||
53 | public void Initialise(Scene scene, IConfigSource config) | ||
54 | { | ||
55 | if (m_sceneList.Count == 0) | ||
56 | { | ||
57 | IConfig startupConfig = config.Configs["Communications"]; | ||
58 | |||
59 | if ((startupConfig != null) && (startupConfig.GetString("InterregionComms", "RESTComms") == "LocalComms")) | ||
60 | { | ||
61 | m_log.Debug("[LOCAL COMMS]: Enabling InterregionComms LocalComms module"); | ||
62 | m_enabled = true; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | if (!m_enabled) | ||
67 | return; | ||
68 | |||
69 | Init(scene); | ||
70 | } | ||
71 | |||
72 | public void PostInitialise() | ||
73 | { | ||
74 | } | ||
75 | |||
76 | public void Close() | ||
77 | { | ||
78 | } | ||
79 | |||
80 | public string Name | ||
81 | { | ||
82 | get { return "LocalInterregionCommsModule"; } | ||
83 | } | ||
84 | |||
85 | public bool IsSharedModule | ||
86 | { | ||
87 | get { return true; } | ||
88 | } | ||
89 | /// <summary> | ||
90 | /// Can be called from other modules. | ||
91 | /// </summary> | ||
92 | /// <param name="scene"></param> | ||
93 | public void Init(Scene scene) | ||
94 | { | ||
95 | if (!m_sceneList.Contains(scene)) | ||
96 | { | ||
97 | lock (m_sceneList) | ||
98 | { | ||
99 | m_sceneList.Add(scene); | ||
100 | if (m_enabled) | ||
101 | scene.RegisterModuleInterface<IInterregionCommsOut>(this); | ||
102 | scene.RegisterModuleInterface<IInterregionCommsIn>(this); | ||
103 | } | ||
104 | |||
105 | } | ||
106 | } | ||
107 | |||
108 | #endregion /* IRegionModule */ | ||
109 | |||
110 | #region IInterregionComms | ||
111 | |||
112 | /** | ||
113 | * Agent-related communications | ||
114 | */ | ||
115 | |||
116 | public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) | ||
117 | { | ||
118 | foreach (Scene s in m_sceneList) | ||
119 | { | ||
120 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
121 | { | ||
122 | // m_log.DebugFormat("[LOCAL COMMS]: Found region {0} to send SendCreateChildAgent", regionHandle); | ||
123 | return s.NewUserConnection(aCircuit, out reason); | ||
124 | } | ||
125 | } | ||
126 | |||
127 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for SendCreateChildAgent", regionHandle); | ||
128 | reason = "Did not find region."; | ||
129 | return false; | ||
130 | } | ||
131 | |||
132 | public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) | ||
133 | { | ||
134 | foreach (Scene s in m_sceneList) | ||
135 | { | ||
136 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
137 | { | ||
138 | //m_log.DebugFormat( | ||
139 | // "[LOCAL COMMS]: Found region {0} {1} to send ChildAgentUpdate", | ||
140 | // s.RegionInfo.RegionName, regionHandle); | ||
141 | |||
142 | s.IncomingChildAgentDataUpdate(cAgentData); | ||
143 | return true; | ||
144 | } | ||
145 | } | ||
146 | |||
147 | // m_log.DebugFormat("[LOCAL COMMS]: Did not find region {0} for ChildAgentUpdate", regionHandle); | ||
148 | return false; | ||
149 | } | ||
150 | |||
151 | public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData) | ||
152 | { | ||
153 | foreach (Scene s in m_sceneList) | ||
154 | { | ||
155 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
156 | { | ||
157 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | ||
158 | s.IncomingChildAgentDataUpdate(cAgentData); | ||
159 | return true; | ||
160 | } | ||
161 | } | ||
162 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); | ||
163 | return false; | ||
164 | } | ||
165 | |||
166 | public bool SendRetrieveRootAgent(ulong regionHandle, UUID id, out IAgentData agent) | ||
167 | { | ||
168 | agent = null; | ||
169 | foreach (Scene s in m_sceneList) | ||
170 | { | ||
171 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
172 | { | ||
173 | //m_log.Debug("[LOCAL COMMS]: Found region to send ChildAgentUpdate"); | ||
174 | return s.IncomingRetrieveRootAgent(id, out agent); | ||
175 | } | ||
176 | } | ||
177 | //m_log.Debug("[LOCAL COMMS]: region not found for ChildAgentUpdate"); | ||
178 | return false; | ||
179 | } | ||
180 | |||
181 | public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri) | ||
182 | { | ||
183 | //uint x, y; | ||
184 | //Utils.LongToUInts(regionHandle, out x, out y); | ||
185 | //x = x / Constants.RegionSize; | ||
186 | //y = y / Constants.RegionSize; | ||
187 | //m_log.Debug("\n >>> Local SendReleaseAgent " + x + "-" + y); | ||
188 | foreach (Scene s in m_sceneList) | ||
189 | { | ||
190 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
191 | { | ||
192 | //m_log.Debug("[LOCAL COMMS]: Found region to SendReleaseAgent"); | ||
193 | return s.IncomingReleaseAgent(id); | ||
194 | } | ||
195 | } | ||
196 | //m_log.Debug("[LOCAL COMMS]: region not found in SendReleaseAgent"); | ||
197 | return false; | ||
198 | } | ||
199 | |||
200 | public bool SendCloseAgent(ulong regionHandle, UUID id) | ||
201 | { | ||
202 | //uint x, y; | ||
203 | //Utils.LongToUInts(regionHandle, out x, out y); | ||
204 | //x = x / Constants.RegionSize; | ||
205 | //y = y / Constants.RegionSize; | ||
206 | //m_log.Debug("\n >>> Local SendCloseAgent " + x + "-" + y); | ||
207 | foreach (Scene s in m_sceneList) | ||
208 | { | ||
209 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
210 | { | ||
211 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCloseAgent"); | ||
212 | return s.IncomingCloseAgent(id); | ||
213 | } | ||
214 | } | ||
215 | //m_log.Debug("[LOCAL COMMS]: region not found in SendCloseAgent"); | ||
216 | return false; | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * Object-related communications | ||
221 | */ | ||
222 | |||
223 | public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall) | ||
224 | { | ||
225 | foreach (Scene s in m_sceneList) | ||
226 | { | ||
227 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
228 | { | ||
229 | //m_log.Debug("[LOCAL COMMS]: Found region to SendCreateObject"); | ||
230 | if (isLocalCall) | ||
231 | { | ||
232 | // We need to make a local copy of the object | ||
233 | ISceneObject sogClone = sog.CloneForNewScene(); | ||
234 | sogClone.SetState(sog.GetStateSnapshot(), | ||
235 | s.RegionInfo.RegionID); | ||
236 | return s.IncomingCreateObject(sogClone); | ||
237 | } | ||
238 | else | ||
239 | { | ||
240 | // Use the object as it came through the wire | ||
241 | return s.IncomingCreateObject(sog); | ||
242 | } | ||
243 | } | ||
244 | } | ||
245 | return false; | ||
246 | } | ||
247 | |||
248 | public bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID) | ||
249 | { | ||
250 | foreach (Scene s in m_sceneList) | ||
251 | { | ||
252 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
253 | { | ||
254 | return s.IncomingCreateObject(userID, itemID); | ||
255 | } | ||
256 | } | ||
257 | return false; | ||
258 | } | ||
259 | |||
260 | |||
261 | #endregion /* IInterregionComms */ | ||
262 | |||
263 | #region Misc | ||
264 | |||
265 | public UUID GetRegionID(ulong regionhandle) | ||
266 | { | ||
267 | foreach (Scene s in m_sceneList) | ||
268 | { | ||
269 | if (s.RegionInfo.RegionHandle == regionhandle) | ||
270 | return s.RegionInfo.RegionID; | ||
271 | } | ||
272 | // ? weird. should not happen | ||
273 | return m_sceneList[0].RegionInfo.RegionID; | ||
274 | } | ||
275 | |||
276 | public bool IsLocalRegion(ulong regionhandle) | ||
277 | { | ||
278 | foreach (Scene s in m_sceneList) | ||
279 | if (s.RegionInfo.RegionHandle == regionhandle) | ||
280 | return true; | ||
281 | return false; | ||
282 | } | ||
283 | |||
284 | #endregion | ||
285 | } | ||
286 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs deleted file mode 100644 index 37305d5..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Interregion/RESTInterregionComms.cs +++ /dev/null | |||
@@ -1,811 +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 | |||
28 | using System; | ||
29 | using System.Collections; | ||
30 | using System.IO; | ||
31 | using System.Net; | ||
32 | using System.Reflection; | ||
33 | using System.Text; | ||
34 | using log4net; | ||
35 | using Nini.Config; | ||
36 | using OpenMetaverse; | ||
37 | using OpenMetaverse.StructuredData; | ||
38 | using OpenSim.Framework; | ||
39 | using OpenSim.Framework.Communications; | ||
40 | using OpenSim.Framework.Communications.Clients; | ||
41 | using OpenSim.Region.Framework.Interfaces; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | using OpenSim.Region.Framework.Scenes.Hypergrid; | ||
44 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
45 | |||
46 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Interregion | ||
47 | { | ||
48 | public class RESTInterregionComms : IRegionModule, IInterregionCommsOut | ||
49 | { | ||
50 | private bool initialized = false; | ||
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
52 | |||
53 | protected bool m_enabled = false; | ||
54 | protected Scene m_aScene; | ||
55 | // RESTInterregionComms does not care about local regions; it delegates that to the Local module | ||
56 | protected LocalInterregionComms m_localBackend; | ||
57 | |||
58 | protected CommunicationsManager m_commsManager; | ||
59 | |||
60 | protected RegionToRegionClient m_regionClient; | ||
61 | |||
62 | protected bool m_safemode; | ||
63 | protected IPAddress m_thisIP; | ||
64 | |||
65 | #region IRegionModule | ||
66 | |||
67 | public virtual void Initialise(Scene scene, IConfigSource config) | ||
68 | { | ||
69 | if (!initialized) | ||
70 | { | ||
71 | initialized = true; | ||
72 | IConfig startupConfig = config.Configs["Communications"]; | ||
73 | |||
74 | if ((startupConfig == null) | ||
75 | || (startupConfig != null) | ||
76 | && (startupConfig.GetString("InterregionComms", "RESTComms") == "RESTComms")) | ||
77 | { | ||
78 | m_log.Info("[REST COMMS]: Enabling InterregionComms RESTComms module"); | ||
79 | m_enabled = true; | ||
80 | if (config.Configs["Hypergrid"] != null) | ||
81 | m_safemode = config.Configs["Hypergrid"].GetBoolean("safemode", false); | ||
82 | |||
83 | InitOnce(scene); | ||
84 | } | ||
85 | } | ||
86 | |||
87 | if (!m_enabled) | ||
88 | return; | ||
89 | |||
90 | InitEach(scene); | ||
91 | |||
92 | } | ||
93 | |||
94 | public virtual void PostInitialise() | ||
95 | { | ||
96 | if (m_enabled) | ||
97 | AddHTTPHandlers(); | ||
98 | } | ||
99 | |||
100 | public virtual void Close() | ||
101 | { | ||
102 | } | ||
103 | |||
104 | public virtual string Name | ||
105 | { | ||
106 | get { return "RESTInterregionCommsModule"; } | ||
107 | } | ||
108 | |||
109 | public virtual bool IsSharedModule | ||
110 | { | ||
111 | get { return true; } | ||
112 | } | ||
113 | |||
114 | protected virtual void InitEach(Scene scene) | ||
115 | { | ||
116 | m_localBackend.Init(scene); | ||
117 | scene.RegisterModuleInterface<IInterregionCommsOut>(this); | ||
118 | } | ||
119 | |||
120 | protected virtual void InitOnce(Scene scene) | ||
121 | { | ||
122 | m_localBackend = new LocalInterregionComms(); | ||
123 | m_commsManager = scene.CommsManager; | ||
124 | m_aScene = scene; | ||
125 | m_regionClient = new RegionToRegionClient(m_aScene); | ||
126 | m_thisIP = Util.GetHostFromDNS(scene.RegionInfo.ExternalHostName); | ||
127 | } | ||
128 | |||
129 | protected virtual void AddHTTPHandlers() | ||
130 | { | ||
131 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/agent/", AgentHandler); | ||
132 | m_aScene.CommsManager.HttpServer.AddHTTPHandler("/object/", ObjectHandler); | ||
133 | } | ||
134 | |||
135 | #endregion /* IRegionModule */ | ||
136 | |||
137 | #region IInterregionComms | ||
138 | |||
139 | /** | ||
140 | * Agent-related communications | ||
141 | */ | ||
142 | |||
143 | public bool SendCreateChildAgent(ulong regionHandle, AgentCircuitData aCircuit, out string reason) | ||
144 | { | ||
145 | // Try local first | ||
146 | if (m_localBackend.SendCreateChildAgent(regionHandle, aCircuit, out reason)) | ||
147 | return true; | ||
148 | |||
149 | // else do the remote thing | ||
150 | if (!m_localBackend.IsLocalRegion(regionHandle)) | ||
151 | { | ||
152 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | ||
153 | if (regInfo != null) | ||
154 | { | ||
155 | m_regionClient.SendUserInformation(regInfo, aCircuit); | ||
156 | |||
157 | return m_regionClient.DoCreateChildAgentCall(regInfo, aCircuit, "None", out reason); | ||
158 | } | ||
159 | //else | ||
160 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | ||
161 | } | ||
162 | return false; | ||
163 | } | ||
164 | |||
165 | public bool SendChildAgentUpdate(ulong regionHandle, AgentData cAgentData) | ||
166 | { | ||
167 | // Try local first | ||
168 | if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData)) | ||
169 | return true; | ||
170 | |||
171 | // else do the remote thing | ||
172 | if (!m_localBackend.IsLocalRegion(regionHandle)) | ||
173 | { | ||
174 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | ||
175 | if (regInfo != null) | ||
176 | { | ||
177 | return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); | ||
178 | } | ||
179 | //else | ||
180 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | ||
181 | } | ||
182 | return false; | ||
183 | |||
184 | } | ||
185 | |||
186 | public bool SendChildAgentUpdate(ulong regionHandle, AgentPosition cAgentData) | ||
187 | { | ||
188 | // Try local first | ||
189 | if (m_localBackend.SendChildAgentUpdate(regionHandle, cAgentData)) | ||
190 | return true; | ||
191 | |||
192 | // else do the remote thing | ||
193 | if (!m_localBackend.IsLocalRegion(regionHandle)) | ||
194 | { | ||
195 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | ||
196 | if (regInfo != null) | ||
197 | { | ||
198 | return m_regionClient.DoChildAgentUpdateCall(regInfo, cAgentData); | ||
199 | } | ||
200 | //else | ||
201 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | ||
202 | } | ||
203 | return false; | ||
204 | |||
205 | } | ||
206 | |||
207 | public bool SendRetrieveRootAgent(ulong regionHandle, UUID id, out IAgentData agent) | ||
208 | { | ||
209 | // Try local first | ||
210 | if (m_localBackend.SendRetrieveRootAgent(regionHandle, id, out agent)) | ||
211 | return true; | ||
212 | |||
213 | // else do the remote thing | ||
214 | if (!m_localBackend.IsLocalRegion(regionHandle)) | ||
215 | { | ||
216 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | ||
217 | if (regInfo != null) | ||
218 | { | ||
219 | return m_regionClient.DoRetrieveRootAgentCall(regInfo, id, out agent); | ||
220 | } | ||
221 | //else | ||
222 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | ||
223 | } | ||
224 | return false; | ||
225 | |||
226 | } | ||
227 | |||
228 | public bool SendReleaseAgent(ulong regionHandle, UUID id, string uri) | ||
229 | { | ||
230 | // Try local first | ||
231 | if (m_localBackend.SendReleaseAgent(regionHandle, id, uri)) | ||
232 | return true; | ||
233 | |||
234 | // else do the remote thing | ||
235 | return m_regionClient.DoReleaseAgentCall(regionHandle, id, uri); | ||
236 | } | ||
237 | |||
238 | |||
239 | public bool SendCloseAgent(ulong regionHandle, UUID id) | ||
240 | { | ||
241 | // Try local first | ||
242 | if (m_localBackend.SendCloseAgent(regionHandle, id)) | ||
243 | return true; | ||
244 | |||
245 | // else do the remote thing | ||
246 | if (!m_localBackend.IsLocalRegion(regionHandle)) | ||
247 | { | ||
248 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | ||
249 | if (regInfo != null) | ||
250 | { | ||
251 | return m_regionClient.DoCloseAgentCall(regInfo, id); | ||
252 | } | ||
253 | //else | ||
254 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | ||
255 | } | ||
256 | return false; | ||
257 | } | ||
258 | |||
259 | /** | ||
260 | * Object-related communications | ||
261 | */ | ||
262 | |||
263 | public bool SendCreateObject(ulong regionHandle, SceneObjectGroup sog, bool isLocalCall) | ||
264 | { | ||
265 | // Try local first | ||
266 | if (m_localBackend.SendCreateObject(regionHandle, sog, true)) | ||
267 | { | ||
268 | //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded"); | ||
269 | return true; | ||
270 | } | ||
271 | |||
272 | // else do the remote thing | ||
273 | if (!m_localBackend.IsLocalRegion(regionHandle)) | ||
274 | { | ||
275 | RegionInfo regInfo = m_commsManager.GridService.RequestNeighbourInfo(regionHandle); | ||
276 | if (regInfo != null) | ||
277 | { | ||
278 | return m_regionClient.DoCreateObjectCall( | ||
279 | regInfo, sog, SceneObjectSerializer.ToXml2Format(sog), m_aScene.m_allowScriptCrossings); | ||
280 | } | ||
281 | //else | ||
282 | // m_log.Warn("[REST COMMS]: Region not found " + regionHandle); | ||
283 | } | ||
284 | return false; | ||
285 | } | ||
286 | |||
287 | public bool SendCreateObject(ulong regionHandle, UUID userID, UUID itemID) | ||
288 | { | ||
289 | // Not Implemented | ||
290 | return false; | ||
291 | } | ||
292 | |||
293 | #endregion /* IInterregionComms */ | ||
294 | |||
295 | #region Incoming calls from remote instances | ||
296 | |||
297 | /** | ||
298 | * Agent-related incoming calls | ||
299 | */ | ||
300 | |||
301 | public Hashtable AgentHandler(Hashtable request) | ||
302 | { | ||
303 | //m_log.Debug("[CONNECTION DEBUGGING]: AgentHandler Called"); | ||
304 | |||
305 | m_log.Debug("---------------------------"); | ||
306 | m_log.Debug(" >> uri=" + request["uri"]); | ||
307 | m_log.Debug(" >> content-type=" + request["content-type"]); | ||
308 | m_log.Debug(" >> http-method=" + request["http-method"]); | ||
309 | m_log.Debug("---------------------------\n"); | ||
310 | |||
311 | Hashtable responsedata = new Hashtable(); | ||
312 | responsedata["content_type"] = "text/html"; | ||
313 | responsedata["keepalive"] = false; | ||
314 | |||
315 | |||
316 | UUID agentID; | ||
317 | string action; | ||
318 | ulong regionHandle; | ||
319 | if (!GetParams((string)request["uri"], out agentID, out regionHandle, out action)) | ||
320 | { | ||
321 | m_log.InfoFormat("[REST COMMS]: Invalid parameters for agent message {0}", request["uri"]); | ||
322 | responsedata["int_response_code"] = 404; | ||
323 | responsedata["str_response_string"] = "false"; | ||
324 | |||
325 | return responsedata; | ||
326 | } | ||
327 | |||
328 | // Next, let's parse the verb | ||
329 | string method = (string)request["http-method"]; | ||
330 | if (method.Equals("PUT")) | ||
331 | { | ||
332 | DoAgentPut(request, responsedata); | ||
333 | return responsedata; | ||
334 | } | ||
335 | else if (method.Equals("POST")) | ||
336 | { | ||
337 | DoAgentPost(request, responsedata, agentID); | ||
338 | return responsedata; | ||
339 | } | ||
340 | else if (method.Equals("GET")) | ||
341 | { | ||
342 | DoAgentGet(request, responsedata, agentID, regionHandle); | ||
343 | return responsedata; | ||
344 | } | ||
345 | else if (method.Equals("DELETE")) | ||
346 | { | ||
347 | DoAgentDelete(request, responsedata, agentID, action, regionHandle); | ||
348 | return responsedata; | ||
349 | } | ||
350 | else | ||
351 | { | ||
352 | m_log.InfoFormat("[REST COMMS]: method {0} not supported in agent message", method); | ||
353 | responsedata["int_response_code"] = 404; | ||
354 | responsedata["str_response_string"] = "false"; | ||
355 | |||
356 | return responsedata; | ||
357 | } | ||
358 | |||
359 | } | ||
360 | |||
361 | protected virtual void DoAgentPost(Hashtable request, Hashtable responsedata, UUID id) | ||
362 | { | ||
363 | if (m_safemode) | ||
364 | { | ||
365 | // Authentication | ||
366 | string authority = string.Empty; | ||
367 | string authToken = string.Empty; | ||
368 | if (!GetAuthentication(request, out authority, out authToken)) | ||
369 | { | ||
370 | m_log.InfoFormat("[REST COMMS]: Authentication failed for agent message {0}", request["uri"]); | ||
371 | responsedata["int_response_code"] = 403; | ||
372 | responsedata["str_response_string"] = "Forbidden"; | ||
373 | return ; | ||
374 | } | ||
375 | if (!VerifyKey(id, authority, authToken)) | ||
376 | { | ||
377 | m_log.InfoFormat("[REST COMMS]: Authentication failed for agent message {0}", request["uri"]); | ||
378 | responsedata["int_response_code"] = 403; | ||
379 | responsedata["str_response_string"] = "Forbidden"; | ||
380 | return ; | ||
381 | } | ||
382 | m_log.DebugFormat("[REST COMMS]: Authentication succeeded for {0}", id); | ||
383 | } | ||
384 | |||
385 | OSDMap args = RegionClient.GetOSDMap((string)request["body"]); | ||
386 | if (args == null) | ||
387 | { | ||
388 | responsedata["int_response_code"] = 400; | ||
389 | responsedata["str_response_string"] = "false"; | ||
390 | return; | ||
391 | } | ||
392 | |||
393 | // retrieve the regionhandle | ||
394 | ulong regionhandle = 0; | ||
395 | if (args["destination_handle"] != null) | ||
396 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); | ||
397 | |||
398 | AgentCircuitData aCircuit = new AgentCircuitData(); | ||
399 | try | ||
400 | { | ||
401 | aCircuit.UnpackAgentCircuitData(args); | ||
402 | } | ||
403 | catch (Exception ex) | ||
404 | { | ||
405 | m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildCreate message {0}", ex.Message); | ||
406 | return; | ||
407 | } | ||
408 | |||
409 | OSDMap resp = new OSDMap(2); | ||
410 | string reason = String.Empty; | ||
411 | |||
412 | // This is the meaning of POST agent | ||
413 | m_regionClient.AdjustUserInformation(aCircuit); | ||
414 | bool result = m_localBackend.SendCreateChildAgent(regionhandle, aCircuit, out reason); | ||
415 | |||
416 | resp["reason"] = OSD.FromString(reason); | ||
417 | resp["success"] = OSD.FromBoolean(result); | ||
418 | |||
419 | // TODO: add reason if not String.Empty? | ||
420 | responsedata["int_response_code"] = 200; | ||
421 | responsedata["str_response_string"] = OSDParser.SerializeJsonString(resp); | ||
422 | } | ||
423 | |||
424 | protected virtual void DoAgentPut(Hashtable request, Hashtable responsedata) | ||
425 | { | ||
426 | OSDMap args = RegionClient.GetOSDMap((string)request["body"]); | ||
427 | if (args == null) | ||
428 | { | ||
429 | responsedata["int_response_code"] = 400; | ||
430 | responsedata["str_response_string"] = "false"; | ||
431 | return; | ||
432 | } | ||
433 | |||
434 | // retrieve the regionhandle | ||
435 | ulong regionhandle = 0; | ||
436 | if (args["destination_handle"] != null) | ||
437 | UInt64.TryParse(args["destination_handle"].AsString(), out regionhandle); | ||
438 | |||
439 | string messageType; | ||
440 | if (args["message_type"] != null) | ||
441 | messageType = args["message_type"].AsString(); | ||
442 | else | ||
443 | { | ||
444 | m_log.Warn("[REST COMMS]: Agent Put Message Type not found. "); | ||
445 | messageType = "AgentData"; | ||
446 | } | ||
447 | |||
448 | bool result = true; | ||
449 | if ("AgentData".Equals(messageType)) | ||
450 | { | ||
451 | AgentData agent = new AgentData(); | ||
452 | try | ||
453 | { | ||
454 | agent.Unpack(args); | ||
455 | } | ||
456 | catch (Exception ex) | ||
457 | { | ||
458 | m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); | ||
459 | return; | ||
460 | } | ||
461 | |||
462 | //agent.Dump(); | ||
463 | // This is one of the meanings of PUT agent | ||
464 | result = m_localBackend.SendChildAgentUpdate(regionhandle, agent); | ||
465 | |||
466 | } | ||
467 | else if ("AgentPosition".Equals(messageType)) | ||
468 | { | ||
469 | AgentPosition agent = new AgentPosition(); | ||
470 | try | ||
471 | { | ||
472 | agent.Unpack(args); | ||
473 | } | ||
474 | catch (Exception ex) | ||
475 | { | ||
476 | m_log.InfoFormat("[REST COMMS]: exception on unpacking ChildAgentUpdate message {0}", ex.Message); | ||
477 | return; | ||
478 | } | ||
479 | //agent.Dump(); | ||
480 | // This is one of the meanings of PUT agent | ||
481 | result = m_localBackend.SendChildAgentUpdate(regionhandle, agent); | ||
482 | |||
483 | } | ||
484 | |||
485 | responsedata["int_response_code"] = 200; | ||
486 | responsedata["str_response_string"] = result.ToString(); | ||
487 | } | ||
488 | |||
489 | protected virtual void DoAgentGet(Hashtable request, Hashtable responsedata, UUID id, ulong regionHandle) | ||
490 | { | ||
491 | IAgentData agent = null; | ||
492 | bool result = m_localBackend.SendRetrieveRootAgent(regionHandle, id, out agent); | ||
493 | OSDMap map = null; | ||
494 | if (result) | ||
495 | { | ||
496 | if (agent != null) // just to make sure | ||
497 | { | ||
498 | map = agent.Pack(); | ||
499 | string strBuffer = ""; | ||
500 | try | ||
501 | { | ||
502 | strBuffer = OSDParser.SerializeJsonString(map); | ||
503 | } | ||
504 | catch (Exception e) | ||
505 | { | ||
506 | m_log.WarnFormat("[REST COMMS]: Exception thrown on serialization of CreateObject: {0}", e.Message); | ||
507 | // ignore. buffer will be empty, caller should check. | ||
508 | } | ||
509 | |||
510 | responsedata["content_type"] = "application/json"; | ||
511 | responsedata["int_response_code"] = 200; | ||
512 | responsedata["str_response_string"] = strBuffer; | ||
513 | } | ||
514 | else | ||
515 | { | ||
516 | responsedata["int_response_code"] = 500; | ||
517 | responsedata["str_response_string"] = "Internal error"; | ||
518 | } | ||
519 | } | ||
520 | else | ||
521 | { | ||
522 | responsedata["int_response_code"] = 404; | ||
523 | responsedata["str_response_string"] = "Not Found"; | ||
524 | } | ||
525 | } | ||
526 | |||
527 | protected virtual void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, ulong regionHandle) | ||
528 | { | ||
529 | //m_log.Debug(" >>> DoDelete action:" + action + "; regionHandle:" + regionHandle); | ||
530 | |||
531 | if (action.Equals("release")) | ||
532 | m_localBackend.SendReleaseAgent(regionHandle, id, ""); | ||
533 | else | ||
534 | m_localBackend.SendCloseAgent(regionHandle, id); | ||
535 | |||
536 | responsedata["int_response_code"] = 200; | ||
537 | responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); | ||
538 | |||
539 | m_log.Debug("[REST COMMS]: Agent Deleted."); | ||
540 | } | ||
541 | |||
542 | /** | ||
543 | * Object-related incoming calls | ||
544 | */ | ||
545 | |||
546 | public Hashtable ObjectHandler(Hashtable request) | ||
547 | { | ||
548 | m_log.Debug("[CONNECTION DEBUGGING]: ObjectHandler Called"); | ||
549 | |||
550 | m_log.Debug("---------------------------"); | ||
551 | m_log.Debug(" >> uri=" + request["uri"]); | ||
552 | m_log.Debug(" >> content-type=" + request["content-type"]); | ||
553 | m_log.Debug(" >> http-method=" + request["http-method"]); | ||
554 | m_log.Debug("---------------------------\n"); | ||
555 | |||
556 | Hashtable responsedata = new Hashtable(); | ||
557 | responsedata["content_type"] = "text/html"; | ||
558 | |||
559 | UUID objectID; | ||
560 | string action; | ||
561 | ulong regionHandle; | ||
562 | if (!GetParams((string)request["uri"], out objectID, out regionHandle, out action)) | ||
563 | { | ||
564 | m_log.InfoFormat("[REST COMMS]: Invalid parameters for object message {0}", request["uri"]); | ||
565 | responsedata["int_response_code"] = 404; | ||
566 | responsedata["str_response_string"] = "false"; | ||
567 | |||
568 | return responsedata; | ||
569 | } | ||
570 | |||
571 | // Next, let's parse the verb | ||
572 | string method = (string)request["http-method"]; | ||
573 | if (method.Equals("POST")) | ||
574 | { | ||
575 | DoObjectPost(request, responsedata, regionHandle); | ||
576 | return responsedata; | ||
577 | } | ||
578 | else if (method.Equals("PUT")) | ||
579 | { | ||
580 | DoObjectPut(request, responsedata, regionHandle); | ||
581 | return responsedata; | ||
582 | } | ||
583 | //else if (method.Equals("DELETE")) | ||
584 | //{ | ||
585 | // DoObjectDelete(request, responsedata, agentID, action, regionHandle); | ||
586 | // return responsedata; | ||
587 | //} | ||
588 | else | ||
589 | { | ||
590 | m_log.InfoFormat("[REST COMMS]: method {0} not supported in object message", method); | ||
591 | responsedata["int_response_code"] = 404; | ||
592 | responsedata["str_response_string"] = "false"; | ||
593 | |||
594 | return responsedata; | ||
595 | } | ||
596 | |||
597 | } | ||
598 | |||
599 | protected virtual void DoObjectPost(Hashtable request, Hashtable responsedata, ulong regionhandle) | ||
600 | { | ||
601 | OSDMap args = RegionClient.GetOSDMap((string)request["body"]); | ||
602 | if (args == null) | ||
603 | { | ||
604 | responsedata["int_response_code"] = 400; | ||
605 | responsedata["str_response_string"] = "false"; | ||
606 | return; | ||
607 | } | ||
608 | |||
609 | string sogXmlStr = "", extraStr = "", stateXmlStr = ""; | ||
610 | if (args["sog"] != null) | ||
611 | sogXmlStr = args["sog"].AsString(); | ||
612 | if (args["extra"] != null) | ||
613 | extraStr = args["extra"].AsString(); | ||
614 | |||
615 | UUID regionID = m_localBackend.GetRegionID(regionhandle); | ||
616 | SceneObjectGroup sog = null; | ||
617 | try | ||
618 | { | ||
619 | sog = SceneObjectSerializer.FromXml2Format(sogXmlStr); | ||
620 | sog.ExtraFromXmlString(extraStr); | ||
621 | } | ||
622 | catch (Exception ex) | ||
623 | { | ||
624 | m_log.InfoFormat("[REST COMMS]: exception on deserializing scene object {0}", ex.Message); | ||
625 | responsedata["int_response_code"] = 400; | ||
626 | responsedata["str_response_string"] = "false"; | ||
627 | return; | ||
628 | } | ||
629 | |||
630 | if ((args["state"] != null) && m_aScene.m_allowScriptCrossings) | ||
631 | { | ||
632 | stateXmlStr = args["state"].AsString(); | ||
633 | if (stateXmlStr != "") | ||
634 | { | ||
635 | try | ||
636 | { | ||
637 | sog.SetState(stateXmlStr, regionID); | ||
638 | } | ||
639 | catch (Exception ex) | ||
640 | { | ||
641 | m_log.InfoFormat("[REST COMMS]: exception on setting state for scene object {0}", ex.Message); | ||
642 | |||
643 | } | ||
644 | } | ||
645 | } | ||
646 | // This is the meaning of POST object | ||
647 | bool result = m_localBackend.SendCreateObject(regionhandle, sog, false); | ||
648 | |||
649 | responsedata["int_response_code"] = 200; | ||
650 | responsedata["str_response_string"] = result.ToString(); | ||
651 | } | ||
652 | |||
653 | protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, ulong regionhandle) | ||
654 | { | ||
655 | OSDMap args = RegionClient.GetOSDMap((string)request["body"]); | ||
656 | if (args == null) | ||
657 | { | ||
658 | responsedata["int_response_code"] = 400; | ||
659 | responsedata["str_response_string"] = "false"; | ||
660 | return; | ||
661 | } | ||
662 | |||
663 | UUID userID = UUID.Zero, itemID = UUID.Zero; | ||
664 | if (args["userid"] != null) | ||
665 | userID = args["userid"].AsUUID(); | ||
666 | if (args["itemid"] != null) | ||
667 | itemID = args["itemid"].AsUUID(); | ||
668 | |||
669 | //UUID regionID = m_localBackend.GetRegionID(regionhandle); | ||
670 | |||
671 | // This is the meaning of PUT object | ||
672 | bool result = m_localBackend.SendCreateObject(regionhandle, userID, itemID); | ||
673 | |||
674 | responsedata["int_response_code"] = 200; | ||
675 | responsedata["str_response_string"] = result.ToString(); | ||
676 | } | ||
677 | |||
678 | #endregion | ||
679 | |||
680 | #region Misc | ||
681 | |||
682 | |||
683 | /// <summary> | ||
684 | /// Extract the param from an uri. | ||
685 | /// </summary> | ||
686 | /// <param name="uri">Something like this: /agent/uuid/ or /agent/uuid/handle/release</param> | ||
687 | /// <param name="uri">uuid on uuid field</param> | ||
688 | /// <param name="action">optional action</param> | ||
689 | public static bool GetParams(string uri, out UUID uuid, out ulong regionHandle, out string action) | ||
690 | { | ||
691 | uuid = UUID.Zero; | ||
692 | action = ""; | ||
693 | regionHandle = 0; | ||
694 | |||
695 | uri = uri.Trim(new char[] { '/' }); | ||
696 | string[] parts = uri.Split('/'); | ||
697 | if (parts.Length <= 1) | ||
698 | { | ||
699 | return false; | ||
700 | } | ||
701 | else | ||
702 | { | ||
703 | if (!UUID.TryParse(parts[1], out uuid)) | ||
704 | return false; | ||
705 | |||
706 | if (parts.Length >= 3) | ||
707 | UInt64.TryParse(parts[2], out regionHandle); | ||
708 | if (parts.Length >= 4) | ||
709 | action = parts[3]; | ||
710 | |||
711 | return true; | ||
712 | } | ||
713 | } | ||
714 | |||
715 | public static bool GetAuthentication(Hashtable request, out string authority, out string authKey) | ||
716 | { | ||
717 | authority = string.Empty; | ||
718 | authKey = string.Empty; | ||
719 | |||
720 | Uri authUri; | ||
721 | Hashtable headers = (Hashtable)request["headers"]; | ||
722 | |||
723 | // Authorization keys look like this: | ||
724 | // http://orgrid.org:8002/<uuid> | ||
725 | if (headers.ContainsKey("authorization") && (string)headers["authorization"] != "None") | ||
726 | { | ||
727 | if (Uri.TryCreate((string)headers["authorization"], UriKind.Absolute, out authUri)) | ||
728 | { | ||
729 | authority = authUri.Authority; | ||
730 | authKey = authUri.PathAndQuery.Trim('/'); | ||
731 | m_log.DebugFormat("[REST COMMS]: Got authority {0} and key {1}", authority, authKey); | ||
732 | return true; | ||
733 | } | ||
734 | else | ||
735 | m_log.Debug("[REST COMMS]: Wrong format for Authorization header: " + (string)headers["authorization"]); | ||
736 | } | ||
737 | else | ||
738 | m_log.Debug("[REST COMMS]: Authorization header not found"); | ||
739 | |||
740 | return false; | ||
741 | } | ||
742 | |||
743 | bool VerifyKey(UUID userID, string authority, string key) | ||
744 | { | ||
745 | string[] parts = authority.Split(':'); | ||
746 | IPAddress ipaddr = IPAddress.None; | ||
747 | uint port = 0; | ||
748 | if (parts.Length <= 2) | ||
749 | ipaddr = Util.GetHostFromDNS(parts[0]); | ||
750 | if (parts.Length == 2) | ||
751 | UInt32.TryParse(parts[1], out port); | ||
752 | |||
753 | // local authority (standalone), local call | ||
754 | if (m_thisIP.Equals(ipaddr) && (m_aScene.RegionInfo.HttpPort == port)) | ||
755 | return ((IAuthentication)m_aScene.CommsManager.UserAdminService).VerifyKey(userID, key); | ||
756 | // remote call | ||
757 | else | ||
758 | return AuthClient.VerifyKey("http://" + authority, userID, key); | ||
759 | } | ||
760 | |||
761 | |||
762 | #endregion Misc | ||
763 | |||
764 | protected class RegionToRegionClient : RegionClient | ||
765 | { | ||
766 | Scene m_aScene = null; | ||
767 | |||
768 | public RegionToRegionClient(Scene s) | ||
769 | { | ||
770 | m_aScene = s; | ||
771 | } | ||
772 | |||
773 | public override ulong GetRegionHandle(ulong handle) | ||
774 | { | ||
775 | if (m_aScene.SceneGridService is HGSceneCommunicationService) | ||
776 | return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.FindRegionHandle(handle); | ||
777 | |||
778 | return handle; | ||
779 | } | ||
780 | |||
781 | public override bool IsHyperlink(ulong handle) | ||
782 | { | ||
783 | if (m_aScene.SceneGridService is HGSceneCommunicationService) | ||
784 | return ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.IsHyperlinkRegion(handle); | ||
785 | |||
786 | return false; | ||
787 | } | ||
788 | |||
789 | public override void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit) | ||
790 | { | ||
791 | try | ||
792 | { | ||
793 | if (m_aScene.SceneGridService is HGSceneCommunicationService) | ||
794 | { | ||
795 | ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.SendUserInformation(regInfo, aCircuit); | ||
796 | } | ||
797 | } | ||
798 | catch // Bad cast | ||
799 | { } | ||
800 | |||
801 | } | ||
802 | |||
803 | public override void AdjustUserInformation(AgentCircuitData aCircuit) | ||
804 | { | ||
805 | if (m_aScene.SceneGridService is HGSceneCommunicationService) | ||
806 | ((HGSceneCommunicationService)(m_aScene.SceneGridService)).m_hg.AdjustUserInformation(aCircuit); | ||
807 | } | ||
808 | } | ||
809 | |||
810 | } | ||
811 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs deleted file mode 100644 index ac2eaed..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/HGInventoryBroker.cs +++ /dev/null | |||
@@ -1,401 +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 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenSim.Services.Connectors; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | ||
43 | { | ||
44 | public class HGInventoryBroker : ISharedRegionModule, IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private bool m_Enabled = false; | ||
51 | private bool m_Initialized = false; | ||
52 | private Scene m_Scene; | ||
53 | private UserProfileCacheService m_UserProfileService; // This should change to IUserProfileService | ||
54 | |||
55 | private IInventoryService m_GridService; | ||
56 | private ISessionAuthInventoryService m_HGService; | ||
57 | |||
58 | private string m_LocalGridInventoryURI = string.Empty; | ||
59 | public string Name | ||
60 | { | ||
61 | get { return "HGInventoryBroker"; } | ||
62 | } | ||
63 | |||
64 | public void Initialise(IConfigSource source) | ||
65 | { | ||
66 | IConfig moduleConfig = source.Configs["Modules"]; | ||
67 | if (moduleConfig != null) | ||
68 | { | ||
69 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
70 | if (name == Name) | ||
71 | { | ||
72 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
73 | if (inventoryConfig == null) | ||
74 | { | ||
75 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", | ||
80 | String.Empty); | ||
81 | string HGDll = inventoryConfig.GetString("HypergridInventoryService", | ||
82 | String.Empty); | ||
83 | |||
84 | if (localDll == String.Empty) | ||
85 | { | ||
86 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | ||
87 | //return; | ||
88 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
89 | } | ||
90 | |||
91 | if (HGDll == String.Empty) | ||
92 | { | ||
93 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); | ||
94 | //return; | ||
95 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
96 | } | ||
97 | |||
98 | Object[] args = new Object[] { source }; | ||
99 | m_GridService = | ||
100 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
101 | args); | ||
102 | |||
103 | m_HGService = | ||
104 | ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll, | ||
105 | args); | ||
106 | |||
107 | if (m_GridService == null) | ||
108 | { | ||
109 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | ||
110 | return; | ||
111 | } | ||
112 | if (m_HGService == null) | ||
113 | { | ||
114 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service"); | ||
115 | return; | ||
116 | } | ||
117 | |||
118 | m_LocalGridInventoryURI = inventoryConfig.GetString("InventoryServerURI", string.Empty); | ||
119 | |||
120 | m_Enabled = true; | ||
121 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | public void PostInitialise() | ||
127 | { | ||
128 | } | ||
129 | |||
130 | public void Close() | ||
131 | { | ||
132 | } | ||
133 | |||
134 | public void AddRegion(Scene scene) | ||
135 | { | ||
136 | if (!m_Enabled) | ||
137 | return; | ||
138 | |||
139 | if (!m_Initialized) | ||
140 | { | ||
141 | m_Scene = scene; | ||
142 | // HACK for now. Ugh! | ||
143 | m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService; | ||
144 | // ugh! | ||
145 | m_UserProfileService.SetInventoryService(this); | ||
146 | scene.CommsManager.UserService.SetInventoryService(this); | ||
147 | |||
148 | m_Initialized = true; | ||
149 | } | ||
150 | |||
151 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
152 | } | ||
153 | |||
154 | public void RemoveRegion(Scene scene) | ||
155 | { | ||
156 | } | ||
157 | |||
158 | public void RegionLoaded(Scene scene) | ||
159 | { | ||
160 | if (!m_Enabled) | ||
161 | return; | ||
162 | |||
163 | m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName); | ||
164 | |||
165 | } | ||
166 | |||
167 | #region IInventoryService | ||
168 | |||
169 | public bool CreateUserInventory(UUID userID) | ||
170 | { | ||
171 | return m_GridService.CreateUserInventory(userID); | ||
172 | } | ||
173 | |||
174 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
175 | { | ||
176 | return m_GridService.GetInventorySkeleton(userId); | ||
177 | } | ||
178 | |||
179 | public InventoryCollection GetUserInventory(UUID userID) | ||
180 | { | ||
181 | if (IsLocalGridUser(userID)) | ||
182 | return m_GridService.GetUserInventory(userID); | ||
183 | else | ||
184 | return null; | ||
185 | } | ||
186 | |||
187 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
188 | { | ||
189 | if (IsLocalGridUser(userID)) | ||
190 | m_GridService.GetUserInventory(userID, callback); | ||
191 | else | ||
192 | { | ||
193 | UUID sessionID = GetSessionID(userID); | ||
194 | string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); | ||
195 | m_HGService.GetUserInventory(uri, sessionID, callback); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
200 | { | ||
201 | return new List<InventoryItemBase>(); | ||
202 | } | ||
203 | |||
204 | public bool AddFolder(InventoryFolderBase folder) | ||
205 | { | ||
206 | if (folder == null) | ||
207 | return false; | ||
208 | |||
209 | if (IsLocalGridUser(folder.Owner)) | ||
210 | return m_GridService.AddFolder(folder); | ||
211 | else | ||
212 | { | ||
213 | UUID sessionID = GetSessionID(folder.Owner); | ||
214 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | ||
215 | return m_HGService.AddFolder(uri, folder, sessionID); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | public bool UpdateFolder(InventoryFolderBase folder) | ||
220 | { | ||
221 | if (folder == null) | ||
222 | return false; | ||
223 | |||
224 | if (IsLocalGridUser(folder.Owner)) | ||
225 | return m_GridService.UpdateFolder(folder); | ||
226 | else | ||
227 | { | ||
228 | UUID sessionID = GetSessionID(folder.Owner); | ||
229 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | ||
230 | return m_HGService.UpdateFolder(uri, folder, sessionID); | ||
231 | } | ||
232 | } | ||
233 | |||
234 | public bool MoveFolder(InventoryFolderBase folder) | ||
235 | { | ||
236 | if (folder == null) | ||
237 | return false; | ||
238 | |||
239 | if (IsLocalGridUser(folder.Owner)) | ||
240 | return m_GridService.MoveFolder(folder); | ||
241 | else | ||
242 | { | ||
243 | UUID sessionID = GetSessionID(folder.Owner); | ||
244 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | ||
245 | return m_HGService.MoveFolder(uri, folder, sessionID); | ||
246 | } | ||
247 | } | ||
248 | |||
249 | public bool PurgeFolder(InventoryFolderBase folder) | ||
250 | { | ||
251 | if (folder == null) | ||
252 | return false; | ||
253 | |||
254 | if (IsLocalGridUser(folder.Owner)) | ||
255 | return m_GridService.PurgeFolder(folder); | ||
256 | else | ||
257 | { | ||
258 | UUID sessionID = GetSessionID(folder.Owner); | ||
259 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | ||
260 | return m_HGService.PurgeFolder(uri, folder, sessionID); | ||
261 | } | ||
262 | } | ||
263 | |||
264 | public bool AddItem(InventoryItemBase item) | ||
265 | { | ||
266 | if (item == null) | ||
267 | return false; | ||
268 | |||
269 | if (IsLocalGridUser(item.Owner)) | ||
270 | return m_GridService.AddItem(item); | ||
271 | else | ||
272 | { | ||
273 | UUID sessionID = GetSessionID(item.Owner); | ||
274 | string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); | ||
275 | return m_HGService.AddItem(uri, item, sessionID); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | public bool UpdateItem(InventoryItemBase item) | ||
280 | { | ||
281 | if (item == null) | ||
282 | return false; | ||
283 | |||
284 | if (IsLocalGridUser(item.Owner)) | ||
285 | return m_GridService.UpdateItem(item); | ||
286 | else | ||
287 | { | ||
288 | UUID sessionID = GetSessionID(item.Owner); | ||
289 | string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); | ||
290 | return m_HGService.UpdateItem(uri, item, sessionID); | ||
291 | } | ||
292 | } | ||
293 | |||
294 | public bool DeleteItem(InventoryItemBase item) | ||
295 | { | ||
296 | if (item == null) | ||
297 | return false; | ||
298 | |||
299 | if (IsLocalGridUser(item.Owner)) | ||
300 | return m_GridService.DeleteItem(item); | ||
301 | else | ||
302 | { | ||
303 | UUID sessionID = GetSessionID(item.Owner); | ||
304 | string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); | ||
305 | return m_HGService.DeleteItem(uri, item, sessionID); | ||
306 | } | ||
307 | } | ||
308 | |||
309 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
310 | { | ||
311 | if (item == null) | ||
312 | return null; | ||
313 | |||
314 | if (IsLocalGridUser(item.Owner)) | ||
315 | return m_GridService.QueryItem(item); | ||
316 | else | ||
317 | { | ||
318 | UUID sessionID = GetSessionID(item.Owner); | ||
319 | string uri = GetUserInventoryURI(item.Owner) + "/" + item.Owner.ToString(); | ||
320 | return m_HGService.QueryItem(uri, item, sessionID); | ||
321 | } | ||
322 | } | ||
323 | |||
324 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
325 | { | ||
326 | if (folder == null) | ||
327 | return null; | ||
328 | |||
329 | if (IsLocalGridUser(folder.Owner)) | ||
330 | return m_GridService.QueryFolder(folder); | ||
331 | else | ||
332 | { | ||
333 | UUID sessionID = GetSessionID(folder.Owner); | ||
334 | string uri = GetUserInventoryURI(folder.Owner) + "/" + folder.Owner.ToString(); | ||
335 | return m_HGService.QueryFolder(uri, folder, sessionID); | ||
336 | } | ||
337 | } | ||
338 | |||
339 | public bool HasInventoryForUser(UUID userID) | ||
340 | { | ||
341 | return false; | ||
342 | } | ||
343 | |||
344 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
345 | { | ||
346 | return null; | ||
347 | } | ||
348 | |||
349 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
350 | { | ||
351 | return new List<InventoryItemBase>(); | ||
352 | } | ||
353 | |||
354 | #endregion | ||
355 | |||
356 | private UUID GetSessionID(UUID userID) | ||
357 | { | ||
358 | ScenePresence sp = m_Scene.GetScenePresence(userID); | ||
359 | if (sp != null) | ||
360 | return sp.ControllingClient.SessionId; | ||
361 | |||
362 | return UUID.Zero; | ||
363 | } | ||
364 | |||
365 | private bool IsLocalGridUser(UUID userID) | ||
366 | { | ||
367 | if (m_UserProfileService == null) | ||
368 | return false; | ||
369 | |||
370 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); | ||
371 | if (uinfo == null) | ||
372 | return true; | ||
373 | |||
374 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); | ||
375 | |||
376 | if ((userInventoryServerURI == m_LocalGridInventoryURI) || (userInventoryServerURI == "")) | ||
377 | { | ||
378 | return true; | ||
379 | } | ||
380 | return false; | ||
381 | } | ||
382 | |||
383 | private string GetUserInventoryURI(UUID userID) | ||
384 | { | ||
385 | string invURI = m_LocalGridInventoryURI; | ||
386 | |||
387 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); | ||
388 | if ((uinfo == null) || (uinfo.UserProfile == null)) | ||
389 | return invURI; | ||
390 | |||
391 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); | ||
392 | |||
393 | if ((userInventoryServerURI != null) && | ||
394 | (userInventoryServerURI != "")) | ||
395 | invURI = userInventoryServerURI; | ||
396 | return invURI; | ||
397 | } | ||
398 | |||
399 | |||
400 | } | ||
401 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs deleted file mode 100644 index 750f1cb..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/LocalInventoryServiceConnector.cs +++ /dev/null | |||
@@ -1,286 +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 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | |||
31 | using System; | ||
32 | using System.Collections.Generic; | ||
33 | using System.Reflection; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Data; | ||
36 | using OpenSim.Server.Base; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | |||
43 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | ||
44 | { | ||
45 | public class LocalInventoryServicesConnector : ISharedRegionModule, IInventoryService | ||
46 | { | ||
47 | private static readonly ILog m_log = | ||
48 | LogManager.GetLogger( | ||
49 | MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private IInventoryService m_InventoryService; | ||
52 | |||
53 | private bool m_Enabled = false; | ||
54 | private bool m_Initialized = false; | ||
55 | |||
56 | public string Name | ||
57 | { | ||
58 | get { return "LocalInventoryServicesConnector"; } | ||
59 | } | ||
60 | |||
61 | public void Initialise(IConfigSource source) | ||
62 | { | ||
63 | IConfig moduleConfig = source.Configs["Modules"]; | ||
64 | if (moduleConfig != null) | ||
65 | { | ||
66 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
67 | if (name == Name) | ||
68 | { | ||
69 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
70 | if (inventoryConfig == null) | ||
71 | { | ||
72 | m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
73 | return; | ||
74 | } | ||
75 | |||
76 | string serviceDll = inventoryConfig.GetString("LocalServiceModule", String.Empty); | ||
77 | |||
78 | if (serviceDll == String.Empty) | ||
79 | { | ||
80 | m_log.Error("[INVENTORY CONNECTOR]: No LocalServiceModule named in section InventoryService"); | ||
81 | return; | ||
82 | } | ||
83 | |||
84 | Object[] args = new Object[] { source }; | ||
85 | m_log.DebugFormat("[INVENTORY CONNECTOR]: Service dll = {0}", serviceDll); | ||
86 | |||
87 | m_InventoryService = ServerUtils.LoadPlugin<IInventoryService>(serviceDll, args); | ||
88 | |||
89 | if (m_InventoryService == null) | ||
90 | { | ||
91 | m_log.Error("[INVENTORY CONNECTOR]: Can't load inventory service"); | ||
92 | //return; | ||
93 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
94 | } | ||
95 | |||
96 | //List<IInventoryDataPlugin> plugins | ||
97 | // = DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>( | ||
98 | // configSettings.StandaloneInventoryPlugin, | ||
99 | // configSettings.StandaloneInventorySource); | ||
100 | |||
101 | //foreach (IInventoryDataPlugin plugin in plugins) | ||
102 | //{ | ||
103 | // // Using the OSP wrapper plugin for database plugins should be made configurable at some point | ||
104 | // m_InventoryService.AddPlugin(new OspInventoryWrapperPlugin(plugin, this)); | ||
105 | //} | ||
106 | |||
107 | m_Enabled = true; | ||
108 | m_log.Info("[INVENTORY CONNECTOR]: Local inventory connector enabled"); | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | public void PostInitialise() | ||
114 | { | ||
115 | } | ||
116 | |||
117 | public void Close() | ||
118 | { | ||
119 | } | ||
120 | |||
121 | public void AddRegion(Scene scene) | ||
122 | { | ||
123 | if (!m_Enabled) | ||
124 | return; | ||
125 | |||
126 | if (!m_Initialized) | ||
127 | { | ||
128 | // ugh! | ||
129 | scene.CommsManager.UserProfileCacheService.SetInventoryService(this); | ||
130 | scene.CommsManager.UserService.SetInventoryService(this); | ||
131 | m_Initialized = true; | ||
132 | } | ||
133 | |||
134 | // m_log.DebugFormat( | ||
135 | // "[INVENTORY CONNECTOR]: Registering IInventoryService to scene {0}", scene.RegionInfo.RegionName); | ||
136 | |||
137 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
138 | } | ||
139 | |||
140 | public void RemoveRegion(Scene scene) | ||
141 | { | ||
142 | } | ||
143 | |||
144 | public void RegionLoaded(Scene scene) | ||
145 | { | ||
146 | if (!m_Enabled) | ||
147 | return; | ||
148 | |||
149 | m_log.InfoFormat( | ||
150 | "[INVENTORY CONNECTOR]: Enabled local invnetory for region {0}", scene.RegionInfo.RegionName); | ||
151 | } | ||
152 | |||
153 | #region IInventoryService | ||
154 | |||
155 | public bool CreateUserInventory(UUID user) | ||
156 | { | ||
157 | return m_InventoryService.CreateUserInventory(user); | ||
158 | } | ||
159 | |||
160 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
161 | { | ||
162 | return m_InventoryService.GetInventorySkeleton(userId); | ||
163 | } | ||
164 | |||
165 | public InventoryCollection GetUserInventory(UUID id) | ||
166 | { | ||
167 | return m_InventoryService.GetUserInventory(id); | ||
168 | } | ||
169 | |||
170 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
171 | { | ||
172 | m_InventoryService.GetUserInventory(userID, callback); | ||
173 | } | ||
174 | |||
175 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
176 | { | ||
177 | return m_InventoryService.GetFolderItems(userID, folderID); | ||
178 | } | ||
179 | |||
180 | /// <summary> | ||
181 | /// Add a new folder to the user's inventory | ||
182 | /// </summary> | ||
183 | /// <param name="folder"></param> | ||
184 | /// <returns>true if the folder was successfully added</returns> | ||
185 | public bool AddFolder(InventoryFolderBase folder) | ||
186 | { | ||
187 | return m_InventoryService.AddFolder(folder); | ||
188 | } | ||
189 | |||
190 | /// <summary> | ||
191 | /// Update a folder in the user's inventory | ||
192 | /// </summary> | ||
193 | /// <param name="folder"></param> | ||
194 | /// <returns>true if the folder was successfully updated</returns> | ||
195 | public bool UpdateFolder(InventoryFolderBase folder) | ||
196 | { | ||
197 | return m_InventoryService.UpdateFolder(folder); | ||
198 | } | ||
199 | |||
200 | /// <summary> | ||
201 | /// Move an inventory folder to a new location | ||
202 | /// </summary> | ||
203 | /// <param name="folder">A folder containing the details of the new location</param> | ||
204 | /// <returns>true if the folder was successfully moved</returns> | ||
205 | public bool MoveFolder(InventoryFolderBase folder) | ||
206 | { | ||
207 | return m_InventoryService.MoveFolder(folder); | ||
208 | } | ||
209 | |||
210 | /// <summary> | ||
211 | /// Purge an inventory folder of all its items and subfolders. | ||
212 | /// </summary> | ||
213 | /// <param name="folder"></param> | ||
214 | /// <returns>true if the folder was successfully purged</returns> | ||
215 | public bool PurgeFolder(InventoryFolderBase folder) | ||
216 | { | ||
217 | return m_InventoryService.PurgeFolder(folder); | ||
218 | } | ||
219 | |||
220 | /// <summary> | ||
221 | /// Add a new item to the user's inventory | ||
222 | /// </summary> | ||
223 | /// <param name="item"></param> | ||
224 | /// <returns>true if the item was successfully added</returns> | ||
225 | public bool AddItem(InventoryItemBase item) | ||
226 | { | ||
227 | return m_InventoryService.AddItem(item); | ||
228 | } | ||
229 | |||
230 | /// <summary> | ||
231 | /// Update an item in the user's inventory | ||
232 | /// </summary> | ||
233 | /// <param name="item"></param> | ||
234 | /// <returns>true if the item was successfully updated</returns> | ||
235 | public bool UpdateItem(InventoryItemBase item) | ||
236 | { | ||
237 | return m_InventoryService.UpdateItem(item); | ||
238 | } | ||
239 | |||
240 | /// <summary> | ||
241 | /// Delete an item from the user's inventory | ||
242 | /// </summary> | ||
243 | /// <param name="item"></param> | ||
244 | /// <returns>true if the item was successfully deleted</returns> | ||
245 | public bool DeleteItem(InventoryItemBase item) | ||
246 | { | ||
247 | return m_InventoryService.DeleteItem(item); | ||
248 | } | ||
249 | |||
250 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
251 | { | ||
252 | return m_InventoryService.QueryItem(item); | ||
253 | } | ||
254 | |||
255 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
256 | { | ||
257 | return m_InventoryService.QueryFolder(folder); | ||
258 | } | ||
259 | |||
260 | /// <summary> | ||
261 | /// Does the given user have an inventory structure? | ||
262 | /// </summary> | ||
263 | /// <param name="userID"></param> | ||
264 | /// <returns></returns> | ||
265 | public bool HasInventoryForUser(UUID userID) | ||
266 | { | ||
267 | return m_InventoryService.HasInventoryForUser(userID); | ||
268 | } | ||
269 | |||
270 | /// <summary> | ||
271 | /// Retrieve the root inventory folder for the given user. | ||
272 | /// </summary> | ||
273 | /// <param name="userID"></param> | ||
274 | /// <returns>null if no root folder was found</returns> | ||
275 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
276 | { | ||
277 | return m_InventoryService.RequestRootFolder(userID); | ||
278 | } | ||
279 | |||
280 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
281 | { | ||
282 | return m_InventoryService.GetActiveGestures(userId); | ||
283 | } | ||
284 | #endregion IInventoryService | ||
285 | } | ||
286 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs deleted file mode 100644 index 5a31f23..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Inventory/RemoteInventoryServiceConnector.cs +++ /dev/null | |||
@@ -1,279 +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 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Statistics; | ||
35 | using OpenSim.Services.Connectors; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenMetaverse; | ||
40 | |||
41 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Inventory | ||
42 | { | ||
43 | public class RemoteInventoryServicesConnector : ISharedRegionModule, IInventoryService | ||
44 | { | ||
45 | private static readonly ILog m_log = | ||
46 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private bool m_Enabled = false; | ||
49 | private bool m_Initialized = false; | ||
50 | private Scene m_Scene; | ||
51 | private InventoryServicesConnector m_RemoteConnector; | ||
52 | |||
53 | public string Name | ||
54 | { | ||
55 | get { return "RemoteInventoryServicesConnector"; } | ||
56 | } | ||
57 | |||
58 | public RemoteInventoryServicesConnector() | ||
59 | { | ||
60 | } | ||
61 | |||
62 | public RemoteInventoryServicesConnector(IConfigSource source) | ||
63 | { | ||
64 | Init(source); | ||
65 | } | ||
66 | |||
67 | private void Init(IConfigSource source) | ||
68 | { | ||
69 | m_RemoteConnector = new InventoryServicesConnector(source); | ||
70 | } | ||
71 | |||
72 | |||
73 | #region ISharedRegionModule | ||
74 | |||
75 | public void Initialise(IConfigSource source) | ||
76 | { | ||
77 | IConfig moduleConfig = source.Configs["Modules"]; | ||
78 | if (moduleConfig != null) | ||
79 | { | ||
80 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
81 | if (name == Name) | ||
82 | { | ||
83 | Init(source); | ||
84 | m_Enabled = true; | ||
85 | |||
86 | m_log.Info("[INVENTORY CONNECTOR]: Remote inventory enabled"); | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | public void PostInitialise() | ||
92 | { | ||
93 | } | ||
94 | |||
95 | public void Close() | ||
96 | { | ||
97 | } | ||
98 | |||
99 | public void AddRegion(Scene scene) | ||
100 | { | ||
101 | if (!m_Enabled) | ||
102 | return; | ||
103 | |||
104 | if (!m_Initialized) | ||
105 | { | ||
106 | m_Scene = scene; | ||
107 | // ugh! | ||
108 | scene.CommsManager.UserProfileCacheService.SetInventoryService(this); | ||
109 | scene.CommsManager.UserService.SetInventoryService(this); | ||
110 | m_Initialized = true; | ||
111 | } | ||
112 | |||
113 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
114 | } | ||
115 | |||
116 | public void RemoveRegion(Scene scene) | ||
117 | { | ||
118 | } | ||
119 | |||
120 | public void RegionLoaded(Scene scene) | ||
121 | { | ||
122 | if (!m_Enabled) | ||
123 | return; | ||
124 | |||
125 | m_log.InfoFormat("[INVENTORY CONNECTOR]: Enabled remote inventory for region {0}", scene.RegionInfo.RegionName); | ||
126 | |||
127 | } | ||
128 | |||
129 | #endregion ISharedRegionModule | ||
130 | |||
131 | #region IInventoryService | ||
132 | |||
133 | public bool CreateUserInventory(UUID user) | ||
134 | { | ||
135 | return false; | ||
136 | } | ||
137 | |||
138 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
139 | { | ||
140 | return new List<InventoryFolderBase>(); | ||
141 | } | ||
142 | |||
143 | public InventoryCollection GetUserInventory(UUID userID) | ||
144 | { | ||
145 | return null; | ||
146 | } | ||
147 | |||
148 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
149 | { | ||
150 | UUID sessionID = GetSessionID(userID); | ||
151 | try | ||
152 | { | ||
153 | m_RemoteConnector.GetUserInventory(userID.ToString(), sessionID, callback); | ||
154 | } | ||
155 | catch (Exception e) | ||
156 | { | ||
157 | if (StatsManager.SimExtraStats != null) | ||
158 | StatsManager.SimExtraStats.AddInventoryServiceRetrievalFailure(); | ||
159 | |||
160 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Request inventory operation failed, {0} {1}", | ||
161 | e.Source, e.Message); | ||
162 | } | ||
163 | |||
164 | } | ||
165 | |||
166 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
167 | { | ||
168 | return new List<InventoryItemBase>(); | ||
169 | } | ||
170 | |||
171 | public bool AddFolder(InventoryFolderBase folder) | ||
172 | { | ||
173 | if (folder == null) | ||
174 | return false; | ||
175 | |||
176 | UUID sessionID = GetSessionID(folder.Owner); | ||
177 | return m_RemoteConnector.AddFolder(folder.Owner.ToString(), folder, sessionID); | ||
178 | } | ||
179 | |||
180 | public bool UpdateFolder(InventoryFolderBase folder) | ||
181 | { | ||
182 | if (folder == null) | ||
183 | return false; | ||
184 | |||
185 | UUID sessionID = GetSessionID(folder.Owner); | ||
186 | return m_RemoteConnector.UpdateFolder(folder.Owner.ToString(), folder, sessionID); | ||
187 | } | ||
188 | |||
189 | public bool MoveFolder(InventoryFolderBase folder) | ||
190 | { | ||
191 | if (folder == null) | ||
192 | return false; | ||
193 | |||
194 | UUID sessionID = GetSessionID(folder.Owner); | ||
195 | return m_RemoteConnector.MoveFolder(folder.Owner.ToString(), folder, sessionID); | ||
196 | } | ||
197 | |||
198 | public bool PurgeFolder(InventoryFolderBase folder) | ||
199 | { | ||
200 | if (folder == null) | ||
201 | return false; | ||
202 | |||
203 | UUID sessionID = GetSessionID(folder.Owner); | ||
204 | return m_RemoteConnector.PurgeFolder(folder.Owner.ToString(), folder, sessionID); | ||
205 | } | ||
206 | |||
207 | public bool AddItem(InventoryItemBase item) | ||
208 | { | ||
209 | if (item == null) | ||
210 | return false; | ||
211 | |||
212 | UUID sessionID = GetSessionID(item.Owner); | ||
213 | return m_RemoteConnector.AddItem(item.Owner.ToString(), item, sessionID); | ||
214 | } | ||
215 | |||
216 | public bool UpdateItem(InventoryItemBase item) | ||
217 | { | ||
218 | if (item == null) | ||
219 | return false; | ||
220 | |||
221 | UUID sessionID = GetSessionID(item.Owner); | ||
222 | return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); | ||
223 | } | ||
224 | |||
225 | public bool DeleteItem(InventoryItemBase item) | ||
226 | { | ||
227 | if (item == null) | ||
228 | return false; | ||
229 | |||
230 | UUID sessionID = GetSessionID(item.Owner); | ||
231 | return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); | ||
232 | } | ||
233 | |||
234 | public InventoryItemBase QueryItem(InventoryItemBase item) | ||
235 | { | ||
236 | if (item == null) | ||
237 | return null; | ||
238 | |||
239 | UUID sessionID = GetSessionID(item.Owner); | ||
240 | return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); | ||
241 | } | ||
242 | |||
243 | public InventoryFolderBase QueryFolder(InventoryFolderBase folder) | ||
244 | { | ||
245 | if (folder == null) | ||
246 | return null; | ||
247 | |||
248 | UUID sessionID = GetSessionID(folder.Owner); | ||
249 | return m_RemoteConnector.QueryFolder(folder.Owner.ToString(), folder, sessionID); | ||
250 | } | ||
251 | |||
252 | public bool HasInventoryForUser(UUID userID) | ||
253 | { | ||
254 | return false; | ||
255 | } | ||
256 | |||
257 | public InventoryFolderBase RequestRootFolder(UUID userID) | ||
258 | { | ||
259 | return null; | ||
260 | } | ||
261 | |||
262 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
263 | { | ||
264 | return new List<InventoryItemBase>(); | ||
265 | } | ||
266 | |||
267 | #endregion | ||
268 | |||
269 | private UUID GetSessionID(UUID userID) | ||
270 | { | ||
271 | ScenePresence sp = m_Scene.GetScenePresence(userID); | ||
272 | if (sp != null) | ||
273 | return sp.ControllingClient.SessionId; | ||
274 | |||
275 | return UUID.Zero; | ||
276 | } | ||
277 | |||
278 | } | ||
279 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Neighbour/LocalNeighbourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Neighbour/LocalNeighbourServiceConnector.cs deleted file mode 100644 index cfebba3..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Neighbour/LocalNeighbourServiceConnector.cs +++ /dev/null | |||
@@ -1,135 +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 | |||
28 | using log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Server.Base; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | |||
39 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Neighbour | ||
40 | { | ||
41 | public class LocalNeighbourServicesConnector : | ||
42 | ISharedRegionModule, INeighbourService | ||
43 | { | ||
44 | private static readonly ILog m_log = | ||
45 | LogManager.GetLogger( | ||
46 | MethodBase.GetCurrentMethod().DeclaringType); | ||
47 | |||
48 | private List<Scene> m_Scenes = new List<Scene>(); | ||
49 | |||
50 | private bool m_Enabled = false; | ||
51 | |||
52 | public LocalNeighbourServicesConnector() | ||
53 | { | ||
54 | } | ||
55 | |||
56 | public LocalNeighbourServicesConnector(List<Scene> scenes) | ||
57 | { | ||
58 | m_Scenes = scenes; | ||
59 | } | ||
60 | |||
61 | #region ISharedRegionModule | ||
62 | |||
63 | public string Name | ||
64 | { | ||
65 | get { return "LocalNeighbourServicesConnector"; } | ||
66 | } | ||
67 | |||
68 | public void Initialise(IConfigSource source) | ||
69 | { | ||
70 | IConfig moduleConfig = source.Configs["Modules"]; | ||
71 | if (moduleConfig != null) | ||
72 | { | ||
73 | string name = moduleConfig.GetString("NeighbourServices", this.Name); | ||
74 | if (name == Name) | ||
75 | { | ||
76 | // m_Enabled rules whether this module registers as INeighbourService or not | ||
77 | m_Enabled = true; | ||
78 | m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled"); | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public void Close() | ||
84 | { | ||
85 | } | ||
86 | |||
87 | public void AddRegion(Scene scene) | ||
88 | { | ||
89 | m_Scenes.Add(scene); | ||
90 | |||
91 | if (!m_Enabled) | ||
92 | return; | ||
93 | |||
94 | scene.RegisterModuleInterface<INeighbourService>(this); | ||
95 | } | ||
96 | |||
97 | public void RegionLoaded(Scene scene) | ||
98 | { | ||
99 | m_log.Info("[NEIGHBOUR CONNECTOR]: Local neighbour connector enabled for region " + scene.RegionInfo.RegionName); | ||
100 | } | ||
101 | |||
102 | public void PostInitialise() | ||
103 | { | ||
104 | } | ||
105 | |||
106 | public void RemoveRegion(Scene scene) | ||
107 | { | ||
108 | // Always remove | ||
109 | if (m_Scenes.Contains(scene)) | ||
110 | m_Scenes.Remove(scene); | ||
111 | } | ||
112 | |||
113 | #endregion ISharedRegionModule | ||
114 | |||
115 | #region INeighbourService | ||
116 | |||
117 | public bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | ||
118 | { | ||
119 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: HelloNeighbour from {0}, to {1}. Count = {2}", | ||
120 | thisRegion.RegionName, regionHandle, m_Scenes.Count); | ||
121 | foreach (Scene s in m_Scenes) | ||
122 | { | ||
123 | if (s.RegionInfo.RegionHandle == regionHandle) | ||
124 | { | ||
125 | m_log.Debug("[NEIGHBOUR CONNECTOR]: Found region to SendHelloNeighbour"); | ||
126 | return s.IncomingHelloNeighbour(thisRegion); | ||
127 | } | ||
128 | } | ||
129 | m_log.DebugFormat("[NEIGHBOUR CONNECTOR]: region handle {0} not found", regionHandle); | ||
130 | return false; | ||
131 | } | ||
132 | |||
133 | #endregion INeighbourService | ||
134 | } | ||
135 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Neighbour/RemoteNeighourServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Neighbour/RemoteNeighourServiceConnector.cs deleted file mode 100644 index 8ea4ca7..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Neighbour/RemoteNeighourServiceConnector.cs +++ /dev/null | |||
@@ -1,148 +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 | |||
28 | using log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Services.Connectors; | ||
35 | using OpenSim.Region.Framework.Interfaces; | ||
36 | using OpenSim.Region.Framework.Scenes; | ||
37 | using OpenSim.Services.Interfaces; | ||
38 | using OpenSim.Server.Base; | ||
39 | |||
40 | namespace OpenSim.Region.CoreModules.ServiceConnectors.Neighbour | ||
41 | { | ||
42 | public class RemoteNeighbourServicesConnector : | ||
43 | NeighbourServicesConnector, ISharedRegionModule, INeighbourService | ||
44 | { | ||
45 | private static readonly ILog m_log = | ||
46 | LogManager.GetLogger( | ||
47 | MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private bool m_Enabled = false; | ||
50 | private LocalNeighbourServicesConnector m_LocalService; | ||
51 | private string serviceDll; | ||
52 | private List<Scene> m_Scenes = new List<Scene>(); | ||
53 | |||
54 | public string Name | ||
55 | { | ||
56 | get { return "RemoteNeighbourServicesConnector"; } | ||
57 | } | ||
58 | |||
59 | public void Initialise(IConfigSource source) | ||
60 | { | ||
61 | IConfig moduleConfig = source.Configs["Modules"]; | ||
62 | if (moduleConfig != null) | ||
63 | { | ||
64 | string name = moduleConfig.GetString("NeighbourServices"); | ||
65 | if (name == Name) | ||
66 | { | ||
67 | m_LocalService = new LocalNeighbourServicesConnector(); | ||
68 | |||
69 | //IConfig neighbourConfig = source.Configs["NeighbourService"]; | ||
70 | //if (neighbourConfig == null) | ||
71 | //{ | ||
72 | // m_log.Error("[NEIGHBOUR CONNECTOR]: NeighbourService missing from OpenSim.ini"); | ||
73 | // return; | ||
74 | //} | ||
75 | //serviceDll = neighbourConfig.GetString("LocalServiceModule", String.Empty); | ||
76 | //if (serviceDll == String.Empty) | ||
77 | //{ | ||
78 | // m_log.Error("[NEIGHBOUR CONNECTOR]: No LocalServiceModule named in section NeighbourService"); | ||
79 | // return; | ||
80 | //} | ||
81 | |||
82 | m_Enabled = true; | ||
83 | |||
84 | m_log.Info("[NEIGHBOUR CONNECTOR]: Remote Neighbour connector enabled"); | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | |||
89 | public void PostInitialise() | ||
90 | { | ||
91 | //if (m_Enabled) | ||
92 | //{ | ||
93 | // Object[] args = new Object[] { m_Scenes }; | ||
94 | // m_LocalService = | ||
95 | // ServerUtils.LoadPlugin<INeighbourService>(serviceDll, | ||
96 | // args); | ||
97 | |||
98 | // if (m_LocalService == null) | ||
99 | // { | ||
100 | // m_log.Error("[NEIGHBOUR CONNECTOR]: Can't load neighbour service"); | ||
101 | // Unregister(); | ||
102 | // return; | ||
103 | // } | ||
104 | //} | ||
105 | } | ||
106 | |||
107 | public void Close() | ||
108 | { | ||
109 | } | ||
110 | |||
111 | public void AddRegion(Scene scene) | ||
112 | { | ||
113 | if (!m_Enabled) | ||
114 | return; | ||
115 | |||
116 | m_MapService = scene.CommsManager.GridService; | ||
117 | m_LocalService.AddRegion(scene); | ||
118 | scene.RegisterModuleInterface<INeighbourService>(this); | ||
119 | } | ||
120 | |||
121 | public void RemoveRegion(Scene scene) | ||
122 | { | ||
123 | if (m_Enabled && m_Scenes.Contains(scene)) | ||
124 | m_LocalService.RemoveRegion(scene); | ||
125 | } | ||
126 | |||
127 | public void RegionLoaded(Scene scene) | ||
128 | { | ||
129 | if (!m_Enabled) | ||
130 | return; | ||
131 | |||
132 | m_log.InfoFormat("[NEIGHBOUR CONNECTOR]: Enabled remote neighbours for region {0}", scene.RegionInfo.RegionName); | ||
133 | |||
134 | } | ||
135 | |||
136 | #region INeighbourService | ||
137 | |||
138 | public override bool HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | ||
139 | { | ||
140 | if (m_LocalService.HelloNeighbour(regionHandle, thisRegion)) | ||
141 | return true; | ||
142 | |||
143 | return base.HelloNeighbour(regionHandle, thisRegion); | ||
144 | } | ||
145 | |||
146 | #endregion INeighbourService | ||
147 | } | ||
148 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/User/LocalUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/User/LocalUserServiceConnector.cs deleted file mode 100644 index daf7a38..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/User/LocalUserServiceConnector.cs +++ /dev/null | |||
@@ -1,126 +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 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using Nini.Config; | ||
32 | using OpenSim.Region.Framework.Interfaces; | ||
33 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Server.Base; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | |||
37 | namespace OpenSim.Region.CoreModules.ServiceConnectors.User | ||
38 | { | ||
39 | public class LocalUserServicesConnector : ISharedRegionModule | ||
40 | { | ||
41 | private static readonly ILog m_log = | ||
42 | LogManager.GetLogger( | ||
43 | MethodBase.GetCurrentMethod().DeclaringType); | ||
44 | |||
45 | private IUserService m_UserService; | ||
46 | |||
47 | private bool m_Enabled = false; | ||
48 | |||
49 | public string Name | ||
50 | { | ||
51 | get { return "LocalUserServicesConnector"; } | ||
52 | } | ||
53 | |||
54 | public void Initialise(IConfigSource source) | ||
55 | { | ||
56 | IConfig moduleConfig = source.Configs["Modules"]; | ||
57 | if (moduleConfig != null) | ||
58 | { | ||
59 | string name = moduleConfig.GetString("UserServices", ""); | ||
60 | if (name == Name) | ||
61 | { | ||
62 | IConfig userConfig = source.Configs["UserService"]; | ||
63 | if (userConfig == null) | ||
64 | { | ||
65 | m_log.Error("[USER CONNECTOR]: UserService missing from OpenSim.ini"); | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | string serviceDll = userConfig.GetString("LocalServiceModule", | ||
70 | String.Empty); | ||
71 | |||
72 | if (serviceDll == String.Empty) | ||
73 | { | ||
74 | m_log.Error("[USER CONNECTOR]: No LocalServiceModule named in section UserService"); | ||
75 | return; | ||
76 | } | ||
77 | |||
78 | Object[] args = new Object[] { source }; | ||
79 | m_UserService = | ||
80 | ServerUtils.LoadPlugin<IUserService>(serviceDll, | ||
81 | args); | ||
82 | |||
83 | if (m_UserService == null) | ||
84 | { | ||
85 | m_log.Error("[USER CONNECTOR]: Can't load user service"); | ||
86 | return; | ||
87 | } | ||
88 | m_Enabled = true; | ||
89 | m_log.Info("[USER CONNECTOR]: Local user connector enabled"); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | |||
94 | public void PostInitialise() | ||
95 | { | ||
96 | if (!m_Enabled) | ||
97 | return; | ||
98 | } | ||
99 | |||
100 | public void Close() | ||
101 | { | ||
102 | if (!m_Enabled) | ||
103 | return; | ||
104 | } | ||
105 | |||
106 | public void AddRegion(Scene scene) | ||
107 | { | ||
108 | if (!m_Enabled) | ||
109 | return; | ||
110 | |||
111 | scene.RegisterModuleInterface<IUserService>(m_UserService); | ||
112 | } | ||
113 | |||
114 | public void RemoveRegion(Scene scene) | ||
115 | { | ||
116 | if (!m_Enabled) | ||
117 | return; | ||
118 | } | ||
119 | |||
120 | public void RegionLoaded(Scene scene) | ||
121 | { | ||
122 | if (!m_Enabled) | ||
123 | return; | ||
124 | } | ||
125 | } | ||
126 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/User/RemoteUserServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/User/RemoteUserServiceConnector.cs deleted file mode 100644 index 68f598e..0000000 --- a/OpenSim/Region/CoreModules/ServiceConnectors/User/RemoteUserServiceConnector.cs +++ /dev/null | |||
@@ -1,87 +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 | |||
28 | using Nini.Config; | ||
29 | using OpenSim.Region.Framework.Interfaces; | ||
30 | using OpenSim.Region.Framework.Scenes; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | |||
33 | namespace OpenSim.Region.CoreModules.ServiceConnectors.User | ||
34 | { | ||
35 | public class RemoteUserServicesConnector : ISharedRegionModule | ||
36 | { | ||
37 | private bool m_Enabled = false; | ||
38 | |||
39 | public string Name | ||
40 | { | ||
41 | get { return "RemoteUserServicesConnector"; } | ||
42 | } | ||
43 | |||
44 | public void Initialise(IConfigSource source) | ||
45 | { | ||
46 | IConfig moduleConfig = source.Configs["Modules"]; | ||
47 | if (moduleConfig != null) | ||
48 | { | ||
49 | string name = moduleConfig.GetString("UserServices", ""); | ||
50 | if (name == Name) | ||
51 | { | ||
52 | m_Enabled = true; | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | |||
57 | public void PostInitialise() | ||
58 | { | ||
59 | if (!m_Enabled) | ||
60 | return; | ||
61 | } | ||
62 | |||
63 | public void Close() | ||
64 | { | ||
65 | if (!m_Enabled) | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | public void AddRegion(Scene scene) | ||
70 | { | ||
71 | if (!m_Enabled) | ||
72 | return; | ||
73 | } | ||
74 | |||
75 | public void RemoveRegion(Scene scene) | ||
76 | { | ||
77 | if (!m_Enabled) | ||
78 | return; | ||
79 | } | ||
80 | |||
81 | public void RegionLoaded(Scene scene) | ||
82 | { | ||
83 | if (!m_Enabled) | ||
84 | return; | ||
85 | } | ||
86 | } | ||
87 | } | ||