aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2009-09-18 20:01:33 -0700
committerDiva Canto2009-09-18 20:01:33 -0700
commit66f8166bd0501a159e2eecad77cc92b0b3beb38e (patch)
tree1960d16f99c54c5a761174d5820b9f08d6af3d41 /OpenSim/Region/CoreModules
parentRenamed the project lslc to OpenSim.Tools.lslc to conform to the naming conve... (diff)
downloadopensim-SC_OLD-66f8166bd0501a159e2eecad77cc92b0b3beb38e.zip
opensim-SC_OLD-66f8166bd0501a159e2eecad77cc92b0b3beb38e.tar.gz
opensim-SC_OLD-66f8166bd0501a159e2eecad77cc92b0b3beb38e.tar.bz2
opensim-SC_OLD-66f8166bd0501a159e2eecad77cc92b0b3beb38e.tar.xz
First pass at LocalGridServiceConnector. Nothing of this is used by the simulator yet.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs175
1 files changed, 175 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
new file mode 100644
index 0000000..6475817
--- /dev/null
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs
@@ -0,0 +1,175 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using Nini.Config;
30using System;
31using System.Collections.Generic;
32using System.Reflection;
33using OpenSim.Framework;
34using OpenSim.Server.Base;
35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces;
38using OpenMetaverse;
39
40namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid
41{
42 public class LocalGridServicesConnector :
43 ISharedRegionModule, IGridService
44 {
45 private static readonly ILog m_log =
46 LogManager.GetLogger(
47 MethodBase.GetCurrentMethod().DeclaringType);
48
49 private IGridService m_GridService;
50
51 private bool m_Enabled = false;
52
53 #region ISharedRegionModule
54
55 public Type ReplaceableInterface
56 {
57 get { return null; }
58 }
59
60 public string Name
61 {
62 get { return "LocalGridServicesConnector"; }
63 }
64
65 public void Initialise(IConfigSource source)
66 {
67 IConfig moduleConfig = source.Configs["Modules"];
68 if (moduleConfig != null)
69 {
70 string name = moduleConfig.GetString("GridServices", "");
71 if (name == Name)
72 {
73 IConfig assetConfig = source.Configs["GridService"];
74 if (assetConfig == null)
75 {
76 m_log.Error("[GRID CONNECTOR]: GridService missing from OpenSim.ini");
77 return;
78 }
79
80 string serviceDll = assetConfig.GetString("LocalServiceModule",
81 String.Empty);
82
83 if (serviceDll == String.Empty)
84 {
85 m_log.Error("[GRID CONNECTOR]: No LocalServiceModule named in section GridService");
86 return;
87 }
88
89 Object[] args = new Object[] { source };
90 m_GridService =
91 ServerUtils.LoadPlugin<IGridService>(serviceDll,
92 args);
93
94 if (m_GridService == null)
95 {
96 m_log.Error("[GRID CONNECTOR]: Can't load asset service");
97 return;
98 }
99 m_Enabled = true;
100 m_log.Info("[GRID CONNECTOR]: Local grid connector enabled");
101 }
102 }
103 }
104
105 public void PostInitialise()
106 {
107 }
108
109 public void Close()
110 {
111 }
112
113 public void AddRegion(Scene scene)
114 {
115 if (!m_Enabled)
116 return;
117
118 scene.RegisterModuleInterface<IGridService>(this);
119 }
120
121 public void RemoveRegion(Scene scene)
122 {
123 }
124
125 public void RegionLoaded(Scene scene)
126 {
127 }
128
129 #endregion
130
131 #region IGridService
132
133 public bool RegisterRegion(UUID scopeID, SimpleRegionInfo regionInfo)
134 {
135 return m_GridService.RegisterRegion(scopeID, regionInfo);
136 }
137
138 public bool DeregisterRegion(UUID regionID)
139 {
140 return m_GridService.DeregisterRegion(regionID);
141 }
142
143 public List<SimpleRegionInfo> GetNeighbours(UUID scopeID, int x, int y)
144 {
145 return m_GridService.GetNeighbours(scopeID, x, y);
146 }
147
148 public SimpleRegionInfo GetRegionByUUID(UUID scopeID, UUID regionID)
149 {
150 return m_GridService.GetRegionByUUID(scopeID, regionID);
151 }
152
153 public SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y)
154 {
155 return m_GridService.GetRegionByPosition(scopeID, x, y);
156 }
157
158 public SimpleRegionInfo GetRegionByName(UUID scopeID, string regionName)
159 {
160 return m_GridService.GetRegionByName(scopeID, regionName);
161 }
162
163 public List<SimpleRegionInfo> GetRegionsByName(UUID scopeID, string name, int maxNumber)
164 {
165 return m_GridService.GetRegionsByName(scopeID, name, maxNumber);
166 }
167
168 public List<SimpleRegionInfo> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
169 {
170 return m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax);
171 }
172
173 #endregion
174 }
175}