diff options
Diffstat (limited to 'OpenSim/Server')
16 files changed, 726 insertions, 37 deletions
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs index 791e1ef..ed0210f 100644 --- a/OpenSim/Server/Base/HttpServerBase.cs +++ b/OpenSim/Server/Base/HttpServerBase.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Threading; | 30 | using System.Threading; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
@@ -40,17 +41,40 @@ namespace OpenSim.Server.Base | |||
40 | { | 41 | { |
41 | // Logger | 42 | // Logger |
42 | // | 43 | // |
43 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 44 | private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
44 | 45 | ||
45 | // The http server instance | 46 | // The http server instance |
46 | // | 47 | // |
47 | protected BaseHttpServer m_HttpServer = null; | 48 | protected BaseHttpServer m_HttpServer = null; |
49 | protected uint m_Port = 0; | ||
50 | protected Dictionary<uint, BaseHttpServer> m_Servers = | ||
51 | new Dictionary<uint, BaseHttpServer>(); | ||
48 | 52 | ||
49 | public IHttpServer HttpServer | 53 | public IHttpServer HttpServer |
50 | { | 54 | { |
51 | get { return m_HttpServer; } | 55 | get { return m_HttpServer; } |
52 | } | 56 | } |
53 | 57 | ||
58 | public uint DefaultPort | ||
59 | { | ||
60 | get { return m_Port; } | ||
61 | } | ||
62 | |||
63 | public IHttpServer GetHttpServer(uint port) | ||
64 | { | ||
65 | m_Log.InfoFormat("[SERVER]: Requested port {0}", port); | ||
66 | if (port == m_Port) | ||
67 | return HttpServer; | ||
68 | |||
69 | if (m_Servers.ContainsKey(port)) | ||
70 | return m_Servers[port]; | ||
71 | |||
72 | m_Servers[port] = new BaseHttpServer(port); | ||
73 | m_Servers[port].Start(); | ||
74 | |||
75 | return m_Servers[port]; | ||
76 | } | ||
77 | |||
54 | // Handle all the automagical stuff | 78 | // Handle all the automagical stuff |
55 | // | 79 | // |
56 | public HttpServerBase(string prompt, string[] args) : base(prompt, args) | 80 | public HttpServerBase(string prompt, string[] args) : base(prompt, args) |
@@ -74,6 +98,8 @@ namespace OpenSim.Server.Base | |||
74 | Thread.CurrentThread.Abort(); | 98 | Thread.CurrentThread.Abort(); |
75 | } | 99 | } |
76 | 100 | ||
101 | m_Port = port; | ||
102 | |||
77 | m_HttpServer = new BaseHttpServer(port); | 103 | m_HttpServer = new BaseHttpServer(port); |
78 | 104 | ||
79 | MainServer.Instance = m_HttpServer; | 105 | MainServer.Instance = m_HttpServer; |
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 6c2b3ed..2340645 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -141,7 +141,9 @@ namespace OpenSim.Server.Base | |||
141 | } | 141 | } |
142 | catch (Exception e) | 142 | catch (Exception e) |
143 | { | 143 | { |
144 | m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); | 144 | if (!(e is System.MissingMethodException)) |
145 | m_log.ErrorFormat("Error loading plugin from {0}, exception {1}", dllName, e.InnerException); | ||
146 | return null; | ||
145 | } | 147 | } |
146 | 148 | ||
147 | return plug; | 149 | return plug; |
@@ -258,6 +260,8 @@ namespace OpenSim.Server.Base | |||
258 | 260 | ||
259 | public static Dictionary<string, object> ParseXmlResponse(string data) | 261 | public static Dictionary<string, object> ParseXmlResponse(string data) |
260 | { | 262 | { |
263 | //m_log.DebugFormat("[XXX]: received xml string: {0}", data); | ||
264 | |||
261 | Dictionary<string, object> ret = new Dictionary<string, object>(); | 265 | Dictionary<string, object> ret = new Dictionary<string, object>(); |
262 | 266 | ||
263 | XmlDocument doc = new XmlDocument(); | 267 | XmlDocument doc = new XmlDocument(); |
@@ -284,7 +288,7 @@ namespace OpenSim.Server.Base | |||
284 | 288 | ||
285 | foreach (XmlNode part in partL) | 289 | foreach (XmlNode part in partL) |
286 | { | 290 | { |
287 | XmlNode type = part.Attributes.GetNamedItem("Type"); | 291 | XmlNode type = part.Attributes.GetNamedItem("type"); |
288 | if (type == null || type.Value != "List") | 292 | if (type == null || type.Value != "List") |
289 | { | 293 | { |
290 | ret[part.Name] = part.InnerText; | 294 | ret[part.Name] = part.InnerText; |
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 7c74e05..f7eb292 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs | |||
@@ -37,13 +37,17 @@ namespace OpenSim.Server.Handlers.Asset | |||
37 | public class AssetServiceConnector : ServiceConnector | 37 | public class AssetServiceConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IAssetService m_AssetService; | 39 | private IAssetService m_AssetService; |
40 | private string m_ConfigName = "AssetService"; | ||
40 | 41 | ||
41 | public AssetServiceConnector(IConfigSource config, IHttpServer server) : | 42 | public AssetServiceConnector(IConfigSource config, IHttpServer server, string configName) : |
42 | base(config, server) | 43 | base(config, server, configName) |
43 | { | 44 | { |
44 | IConfig serverConfig = config.Configs["AssetService"]; | 45 | if (configName != String.Empty) |
46 | m_ConfigName = configName; | ||
47 | |||
48 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
45 | if (serverConfig == null) | 49 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 50 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
47 | 51 | ||
48 | string assetService = serverConfig.GetString("LocalServiceModule", | 52 | string assetService = serverConfig.GetString("LocalServiceModule", |
49 | String.Empty); | 53 | String.Empty); |
@@ -55,7 +59,6 @@ namespace OpenSim.Server.Handlers.Asset | |||
55 | m_AssetService = | 59 | m_AssetService = |
56 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); | 60 | ServerUtils.LoadPlugin<IAssetService>(assetService, args); |
57 | 61 | ||
58 | //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no")); | ||
59 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); | 62 | server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); |
60 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); | 63 | server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); |
61 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); | 64 | server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); |
diff --git a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs index 589dc3b..2abef0a 100644 --- a/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authentication/AuthenticationServerConnector.cs | |||
@@ -37,13 +37,17 @@ namespace OpenSim.Server.Handlers.Authentication | |||
37 | public class AuthenticationServiceConnector : ServiceConnector | 37 | public class AuthenticationServiceConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IAuthenticationService m_AuthenticationService; | 39 | private IAuthenticationService m_AuthenticationService; |
40 | private string m_ConfigName = "AuthenticationService"; | ||
40 | 41 | ||
41 | public AuthenticationServiceConnector(IConfigSource config, IHttpServer server) : | 42 | public AuthenticationServiceConnector(IConfigSource config, IHttpServer server, string configName) : |
42 | base(config, server) | 43 | base(config, server, configName) |
43 | { | 44 | { |
44 | IConfig serverConfig = config.Configs["AuthenticationService"]; | 45 | if (configName != String.Empty) |
46 | m_ConfigName = configName; | ||
47 | |||
48 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
45 | if (serverConfig == null) | 49 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 50 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
47 | 51 | ||
48 | string authenticationService = serverConfig.GetString("AuthenticationServiceModule", | 52 | string authenticationService = serverConfig.GetString("AuthenticationServiceModule", |
49 | String.Empty); | 53 | String.Empty); |
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs index 0d9f239..20fd0f7 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerConnector.cs | |||
@@ -37,13 +37,16 @@ namespace OpenSim.Server.Handlers.Authorization | |||
37 | public class AuthorizationServerConnector : ServiceConnector | 37 | public class AuthorizationServerConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IAuthorizationService m_AuthorizationService; | 39 | private IAuthorizationService m_AuthorizationService; |
40 | private string m_ConfigName = "AuthorizationService"; | ||
40 | 41 | ||
41 | public AuthorizationServerConnector(IConfigSource config, IHttpServer server) : | 42 | public AuthorizationServerConnector(IConfigSource config, IHttpServer server, string configName) : |
42 | base(config, server) | 43 | base(config, server, configName) |
43 | { | 44 | { |
44 | IConfig serverConfig = config.Configs["AuthorizationService"]; | 45 | if (configName != String.Empty) |
46 | m_ConfigName = configName; | ||
47 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
45 | if (serverConfig == null) | 48 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 49 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
47 | 50 | ||
48 | string authorizationService = serverConfig.GetString("LocalServiceModule", | 51 | string authorizationService = serverConfig.GetString("LocalServiceModule", |
49 | String.Empty); | 52 | String.Empty); |
diff --git a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs index 69acd25..f987de4 100644 --- a/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Authorization/AuthorizationServerPostHandler.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Server.Handlers.Authorization | |||
44 | { | 44 | { |
45 | public class AuthorizationServerPostHandler : BaseStreamHandler | 45 | public class AuthorizationServerPostHandler : BaseStreamHandler |
46 | { | 46 | { |
47 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | private IAuthorizationService m_AuthorizationService; | 49 | private IAuthorizationService m_AuthorizationService; |
50 | 50 | ||
diff --git a/OpenSim/Server/Handlers/Base/ServerConnector.cs b/OpenSim/Server/Handlers/Base/ServerConnector.cs index 62fe773..71876da 100644 --- a/OpenSim/Server/Handlers/Base/ServerConnector.cs +++ b/OpenSim/Server/Handlers/Base/ServerConnector.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Server.Handlers.Base | |||
39 | 39 | ||
40 | public class ServiceConnector : IServiceConnector | 40 | public class ServiceConnector : IServiceConnector |
41 | { | 41 | { |
42 | public ServiceConnector(IConfigSource config, IHttpServer server) | 42 | public ServiceConnector(IConfigSource config, IHttpServer server, string configName) |
43 | { | 43 | { |
44 | } | 44 | } |
45 | } | 45 | } |
diff --git a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs index a4ab0d3..07bafc8 100644 --- a/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs +++ b/OpenSim/Server/Handlers/Freeswitch/FreeswitchServerConnector.cs | |||
@@ -37,19 +37,23 @@ namespace OpenSim.Server.Handlers.Freeswitch | |||
37 | public class FreeswitchServerConnector : ServiceConnector | 37 | public class FreeswitchServerConnector : ServiceConnector |
38 | { | 38 | { |
39 | private IFreeswitchService m_FreeswitchService; | 39 | private IFreeswitchService m_FreeswitchService; |
40 | private string m_ConfigName = "FreeswitchService"; | ||
40 | 41 | ||
41 | public FreeswitchServerConnector(IConfigSource config, IHttpServer server) : | 42 | public FreeswitchServerConnector(IConfigSource config, IHttpServer server, string configName) : |
42 | base(config, server) | 43 | base(config, server, configName) |
43 | { | 44 | { |
44 | IConfig serverConfig = config.Configs["FreeswitchService"]; | 45 | if (configName != String.Empty) |
46 | m_ConfigName = configName; | ||
47 | |||
48 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
45 | if (serverConfig == null) | 49 | if (serverConfig == null) |
46 | throw new Exception("No section 'Server' in config file"); | 50 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
47 | 51 | ||
48 | string freeswitchService = serverConfig.GetString("LocalServiceModule", | 52 | string freeswitchService = serverConfig.GetString("LocalServiceModule", |
49 | String.Empty); | 53 | String.Empty); |
50 | 54 | ||
51 | if (freeswitchService == String.Empty) | 55 | if (freeswitchService == String.Empty) |
52 | throw new Exception("No FreeswitchService in config file"); | 56 | throw new Exception("No LocalServiceModule in config file"); |
53 | 57 | ||
54 | Object[] args = new Object[] { config }; | 58 | Object[] args = new Object[] { config }; |
55 | m_FreeswitchService = | 59 | m_FreeswitchService = |
diff --git a/OpenSim/Server/Handlers/Grid/GridServerConnector.cs b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs new file mode 100644 index 0000000..14daf12 --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/GridServerConnector.cs | |||
@@ -0,0 +1,61 @@ | |||
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 Nini.Config; | ||
30 | using OpenSim.Server.Base; | ||
31 | using OpenSim.Services.Interfaces; | ||
32 | using OpenSim.Framework.Servers.HttpServer; | ||
33 | using OpenSim.Server.Handlers.Base; | ||
34 | |||
35 | namespace OpenSim.Server.Handlers.Grid | ||
36 | { | ||
37 | public class GridServiceConnector : ServiceConnector | ||
38 | { | ||
39 | private IGridService m_GridService; | ||
40 | private string m_ConfigName = "GridService"; | ||
41 | |||
42 | public GridServiceConnector(IConfigSource config, IHttpServer server, string configName) : | ||
43 | base(config, server, configName) | ||
44 | { | ||
45 | IConfig serverConfig = config.Configs[m_ConfigName]; | ||
46 | if (serverConfig == null) | ||
47 | throw new Exception(String.Format("No section {0} in config file", m_ConfigName)); | ||
48 | |||
49 | string gridService = serverConfig.GetString("LocalServiceModule", | ||
50 | String.Empty); | ||
51 | |||
52 | if (gridService == String.Empty) | ||
53 | throw new Exception("No LocalServiceModule in config file"); | ||
54 | |||
55 | Object[] args = new Object[] { config }; | ||
56 | m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); | ||
57 | |||
58 | server.AddStreamHandler(new GridServerPostHandler(m_GridService)); | ||
59 | } | ||
60 | } | ||
61 | } | ||
diff --git a/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs new file mode 100644 index 0000000..b9a4867 --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/GridServerPostHandler.cs | |||
@@ -0,0 +1,433 @@ | |||
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 log4net; | ||
30 | using System; | ||
31 | using System.Reflection; | ||
32 | using System.IO; | ||
33 | using System.Net; | ||
34 | using System.Text; | ||
35 | using System.Text.RegularExpressions; | ||
36 | using System.Xml; | ||
37 | using System.Xml.Serialization; | ||
38 | using System.Collections.Generic; | ||
39 | using OpenSim.Server.Base; | ||
40 | using OpenSim.Services.Interfaces; | ||
41 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
42 | using OpenSim.Framework; | ||
43 | using OpenSim.Framework.Servers.HttpServer; | ||
44 | using OpenMetaverse; | ||
45 | |||
46 | namespace OpenSim.Server.Handlers.Grid | ||
47 | { | ||
48 | public class GridServerPostHandler : BaseStreamHandler | ||
49 | { | ||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
52 | private IGridService m_GridService; | ||
53 | |||
54 | public GridServerPostHandler(IGridService service) : | ||
55 | base("POST", "/grid") | ||
56 | { | ||
57 | m_GridService = service; | ||
58 | } | ||
59 | |||
60 | public override byte[] Handle(string path, Stream requestData, | ||
61 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
62 | { | ||
63 | StreamReader sr = new StreamReader(requestData); | ||
64 | string body = sr.ReadToEnd(); | ||
65 | sr.Close(); | ||
66 | body = body.Trim(); | ||
67 | |||
68 | //m_log.DebugFormat("[XXX]: query String: {0}", body); | ||
69 | |||
70 | Dictionary<string, string> request = | ||
71 | ServerUtils.ParseQueryString(body); | ||
72 | |||
73 | if (!request.ContainsKey("METHOD")) | ||
74 | return FailureResult(); | ||
75 | |||
76 | string method = request["METHOD"]; | ||
77 | |||
78 | switch (method) | ||
79 | { | ||
80 | case "register": | ||
81 | return Register(request); | ||
82 | |||
83 | case "deregister": | ||
84 | return Deregister(request); | ||
85 | |||
86 | case "get_neighbours": | ||
87 | return GetNeighbours(request); | ||
88 | |||
89 | case "get_region_by_uuid": | ||
90 | return GetRegionByUUID(request); | ||
91 | |||
92 | case "get_region_by_position": | ||
93 | return GetRegionByPosition(request); | ||
94 | |||
95 | case "get_region_by_name": | ||
96 | return GetRegionByName(request); | ||
97 | |||
98 | case "get_regions_by_name": | ||
99 | return GetRegionsByName(request); | ||
100 | |||
101 | case "get_region_range": | ||
102 | return GetRegionRange(request); | ||
103 | |||
104 | } | ||
105 | |||
106 | m_log.DebugFormat("[GRID HANDLER]: unknown method {0} request {1}", method.Length, method); | ||
107 | return FailureResult(); | ||
108 | |||
109 | } | ||
110 | |||
111 | #region Method-specific handlers | ||
112 | |||
113 | byte[] Register(Dictionary<string, string> request) | ||
114 | { | ||
115 | UUID scopeID = UUID.Zero; | ||
116 | if (request["SCOPEID"] != null) | ||
117 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
118 | else | ||
119 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region"); | ||
120 | |||
121 | Dictionary<string, object> rinfoData = new Dictionary<string, object>(); | ||
122 | foreach (KeyValuePair<string, string> kvp in request) | ||
123 | rinfoData[kvp.Key] = kvp.Value; | ||
124 | GridRegion rinfo = new GridRegion(rinfoData); | ||
125 | |||
126 | bool result = m_GridService.RegisterRegion(scopeID, rinfo); | ||
127 | |||
128 | if (result) | ||
129 | return SuccessResult(); | ||
130 | else | ||
131 | return FailureResult(); | ||
132 | } | ||
133 | |||
134 | byte[] Deregister(Dictionary<string, string> request) | ||
135 | { | ||
136 | UUID regionID = UUID.Zero; | ||
137 | if (request["REGIONID"] != null) | ||
138 | UUID.TryParse(request["REGIONID"], out regionID); | ||
139 | else | ||
140 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region"); | ||
141 | |||
142 | bool result = m_GridService.DeregisterRegion(regionID); | ||
143 | |||
144 | if (result) | ||
145 | return SuccessResult(); | ||
146 | else | ||
147 | return FailureResult(); | ||
148 | |||
149 | } | ||
150 | |||
151 | byte[] GetNeighbours(Dictionary<string, string> request) | ||
152 | { | ||
153 | UUID scopeID = UUID.Zero; | ||
154 | if (request["SCOPEID"] != null) | ||
155 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
156 | else | ||
157 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); | ||
158 | |||
159 | UUID regionID = UUID.Zero; | ||
160 | if (request["REGIONID"] != null) | ||
161 | UUID.TryParse(request["REGIONID"], out regionID); | ||
162 | else | ||
163 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); | ||
164 | |||
165 | List<GridRegion> rinfos = m_GridService.GetNeighbours(scopeID, regionID); | ||
166 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
167 | |||
168 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
169 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
170 | result["result"] = "null"; | ||
171 | else | ||
172 | { | ||
173 | int i = 0; | ||
174 | foreach (GridRegion rinfo in rinfos) | ||
175 | { | ||
176 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
177 | result["region" + i] = rinfoDict; | ||
178 | i++; | ||
179 | } | ||
180 | } | ||
181 | |||
182 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
183 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
184 | UTF8Encoding encoding = new UTF8Encoding(); | ||
185 | return encoding.GetBytes(xmlString); | ||
186 | |||
187 | } | ||
188 | |||
189 | byte[] GetRegionByUUID(Dictionary<string, string> request) | ||
190 | { | ||
191 | UUID scopeID = UUID.Zero; | ||
192 | if (request["SCOPEID"] != null) | ||
193 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
194 | else | ||
195 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours"); | ||
196 | |||
197 | UUID regionID = UUID.Zero; | ||
198 | if (request["REGIONID"] != null) | ||
199 | UUID.TryParse(request["REGIONID"], out regionID); | ||
200 | else | ||
201 | m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours"); | ||
202 | |||
203 | GridRegion rinfo = m_GridService.GetRegionByUUID(scopeID, regionID); | ||
204 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
205 | |||
206 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
207 | if (rinfo == null) | ||
208 | result["result"] = "null"; | ||
209 | else | ||
210 | result["result"] = rinfo.ToKeyValuePairs(); | ||
211 | |||
212 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
213 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
214 | UTF8Encoding encoding = new UTF8Encoding(); | ||
215 | return encoding.GetBytes(xmlString); | ||
216 | } | ||
217 | |||
218 | byte[] GetRegionByPosition(Dictionary<string, string> request) | ||
219 | { | ||
220 | UUID scopeID = UUID.Zero; | ||
221 | if (request["SCOPEID"] != null) | ||
222 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
223 | else | ||
224 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position"); | ||
225 | |||
226 | int x = 0, y = 0; | ||
227 | if (request["X"] != null) | ||
228 | Int32.TryParse(request["X"], out x); | ||
229 | else | ||
230 | m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position"); | ||
231 | if (request["Y"] != null) | ||
232 | Int32.TryParse(request["Y"], out y); | ||
233 | else | ||
234 | m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position"); | ||
235 | |||
236 | GridRegion rinfo = m_GridService.GetRegionByPosition(scopeID, x, y); | ||
237 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
238 | |||
239 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
240 | if (rinfo == null) | ||
241 | result["result"] = "null"; | ||
242 | else | ||
243 | result["result"] = rinfo.ToKeyValuePairs(); | ||
244 | |||
245 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
246 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
247 | UTF8Encoding encoding = new UTF8Encoding(); | ||
248 | return encoding.GetBytes(xmlString); | ||
249 | } | ||
250 | |||
251 | byte[] GetRegionByName(Dictionary<string, string> request) | ||
252 | { | ||
253 | UUID scopeID = UUID.Zero; | ||
254 | if (request["SCOPEID"] != null) | ||
255 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
256 | else | ||
257 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name"); | ||
258 | |||
259 | string regionName = string.Empty; | ||
260 | if (request["NAME"] != null) | ||
261 | regionName = request["NAME"]; | ||
262 | else | ||
263 | m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name"); | ||
264 | |||
265 | GridRegion rinfo = m_GridService.GetRegionByName(scopeID, regionName); | ||
266 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
267 | |||
268 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
269 | if (rinfo == null) | ||
270 | result["result"] = "null"; | ||
271 | else | ||
272 | result["result"] = rinfo.ToKeyValuePairs(); | ||
273 | |||
274 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
275 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
276 | UTF8Encoding encoding = new UTF8Encoding(); | ||
277 | return encoding.GetBytes(xmlString); | ||
278 | } | ||
279 | |||
280 | byte[] GetRegionsByName(Dictionary<string, string> request) | ||
281 | { | ||
282 | UUID scopeID = UUID.Zero; | ||
283 | if (request["SCOPEID"] != null) | ||
284 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
285 | else | ||
286 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name"); | ||
287 | |||
288 | string regionName = string.Empty; | ||
289 | if (request["NAME"] != null) | ||
290 | regionName = request["NAME"]; | ||
291 | else | ||
292 | m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name"); | ||
293 | |||
294 | int max = 0; | ||
295 | if (request["MAX"] != null) | ||
296 | Int32.TryParse(request["MAX"], out max); | ||
297 | else | ||
298 | m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name"); | ||
299 | |||
300 | List<GridRegion> rinfos = m_GridService.GetRegionsByName(scopeID, regionName, max); | ||
301 | //m_log.DebugFormat("[GRID HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); | ||
302 | |||
303 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
304 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
305 | result["result"] = "null"; | ||
306 | else | ||
307 | { | ||
308 | int i = 0; | ||
309 | foreach (GridRegion rinfo in rinfos) | ||
310 | { | ||
311 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
312 | result["region" + i] = rinfoDict; | ||
313 | i++; | ||
314 | } | ||
315 | } | ||
316 | |||
317 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
318 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
319 | UTF8Encoding encoding = new UTF8Encoding(); | ||
320 | return encoding.GetBytes(xmlString); | ||
321 | } | ||
322 | |||
323 | byte[] GetRegionRange(Dictionary<string, string> request) | ||
324 | { | ||
325 | //m_log.DebugFormat("[GRID HANDLER]: GetRegionRange"); | ||
326 | UUID scopeID = UUID.Zero; | ||
327 | if (request.ContainsKey("SCOPEID")) | ||
328 | UUID.TryParse(request["SCOPEID"], out scopeID); | ||
329 | else | ||
330 | m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range"); | ||
331 | |||
332 | int xmin = 0, xmax = 0, ymin = 0, ymax = 0; | ||
333 | if (request.ContainsKey("XMIN")) | ||
334 | Int32.TryParse(request["XMIN"], out xmin); | ||
335 | else | ||
336 | m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range"); | ||
337 | if (request.ContainsKey("XMAX")) | ||
338 | Int32.TryParse(request["XMAX"], out xmax); | ||
339 | else | ||
340 | m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range"); | ||
341 | if (request.ContainsKey("YMIN")) | ||
342 | Int32.TryParse(request["YMIN"], out ymin); | ||
343 | else | ||
344 | m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range"); | ||
345 | if (request.ContainsKey("YMAX")) | ||
346 | Int32.TryParse(request["YMAX"], out ymax); | ||
347 | else | ||
348 | m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range"); | ||
349 | |||
350 | |||
351 | List<GridRegion> rinfos = m_GridService.GetRegionRange(scopeID, xmin, xmax, ymin, ymax); | ||
352 | |||
353 | Dictionary<string, object> result = new Dictionary<string, object>(); | ||
354 | if ((rinfos == null) || ((rinfos != null) && (rinfos.Count == 0))) | ||
355 | result["result"] = "null"; | ||
356 | else | ||
357 | { | ||
358 | int i = 0; | ||
359 | foreach (GridRegion rinfo in rinfos) | ||
360 | { | ||
361 | Dictionary<string, object> rinfoDict = rinfo.ToKeyValuePairs(); | ||
362 | result["region" + i] = rinfoDict; | ||
363 | i++; | ||
364 | } | ||
365 | } | ||
366 | string xmlString = ServerUtils.BuildXmlResponse(result); | ||
367 | //m_log.DebugFormat("[GRID HANDLER]: resp string: {0}", xmlString); | ||
368 | UTF8Encoding encoding = new UTF8Encoding(); | ||
369 | return encoding.GetBytes(xmlString); | ||
370 | } | ||
371 | |||
372 | #endregion | ||
373 | |||
374 | #region Misc | ||
375 | |||
376 | private byte[] SuccessResult() | ||
377 | { | ||
378 | XmlDocument doc = new XmlDocument(); | ||
379 | |||
380 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
381 | "", ""); | ||
382 | |||
383 | doc.AppendChild(xmlnode); | ||
384 | |||
385 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
386 | ""); | ||
387 | |||
388 | doc.AppendChild(rootElement); | ||
389 | |||
390 | XmlElement result = doc.CreateElement("", "Result", ""); | ||
391 | result.AppendChild(doc.CreateTextNode("Success")); | ||
392 | |||
393 | rootElement.AppendChild(result); | ||
394 | |||
395 | return DocToBytes(doc); | ||
396 | } | ||
397 | |||
398 | private byte[] FailureResult() | ||
399 | { | ||
400 | XmlDocument doc = new XmlDocument(); | ||
401 | |||
402 | XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, | ||
403 | "", ""); | ||
404 | |||
405 | doc.AppendChild(xmlnode); | ||
406 | |||
407 | XmlElement rootElement = doc.CreateElement("", "ServerResponse", | ||
408 | ""); | ||
409 | |||
410 | doc.AppendChild(rootElement); | ||
411 | |||
412 | XmlElement result = doc.CreateElement("", "Result", ""); | ||
413 | result.AppendChild(doc.CreateTextNode("Failure")); | ||
414 | |||
415 | rootElement.AppendChild(result); | ||
416 | |||
417 | return DocToBytes(doc); | ||
418 | } | ||
419 | |||
420 | private byte[] DocToBytes(XmlDocument doc) | ||
421 | { | ||
422 | MemoryStream ms = new MemoryStream(); | ||
423 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
424 | xw.Formatting = Formatting.Indented; | ||
425 | doc.WriteTo(xw); | ||
426 | xw.Flush(); | ||
427 | |||
428 | return ms.ToArray(); | ||
429 | } | ||
430 | |||
431 | #endregion | ||
432 | } | ||
433 | } | ||
diff --git a/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs new file mode 100644 index 0000000..e226759 --- /dev/null +++ b/OpenSim/Server/Handlers/Grid/HypergridServerConnector.cs | |||
@@ -0,0 +1,112 @@ | |||
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.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using System.Net; | ||
33 | using Nini.Config; | ||
34 | using OpenSim.Framework; | ||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Services.Interfaces; | ||
37 | using OpenSim.Framework.Servers.HttpServer; | ||
38 | using OpenSim.Server.Handlers.Base; | ||
39 | |||
40 | using log4net; | ||
41 | using Nwc.XmlRpc; | ||
42 | |||
43 | namespace OpenSim.Server.Handlers.Grid | ||
44 | { | ||
45 | public class HypergridServiceInConnector : ServiceConnector | ||
46 | { | ||
47 | private static readonly ILog m_log = | ||
48 | LogManager.GetLogger( | ||
49 | MethodBase.GetCurrentMethod().DeclaringType); | ||
50 | |||
51 | private List<SimpleRegionInfo> m_RegionsOnSim = new List<SimpleRegionInfo>(); | ||
52 | |||
53 | public HypergridServiceInConnector(IConfigSource config, IHttpServer server) : | ||
54 | base(config, server, String.Empty) | ||
55 | { | ||
56 | server.AddXmlRPCHandler("linkk_region", LinkRegionRequest, false); | ||
57 | } | ||
58 | |||
59 | /// <summary> | ||
60 | /// Someone wants to link to us | ||
61 | /// </summary> | ||
62 | /// <param name="request"></param> | ||
63 | /// <returns></returns> | ||
64 | public XmlRpcResponse LinkRegionRequest(XmlRpcRequest request, IPEndPoint remoteClient) | ||
65 | { | ||
66 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
67 | //string host = (string)requestData["host"]; | ||
68 | //string portstr = (string)requestData["port"]; | ||
69 | string name = (string)requestData["region_name"]; | ||
70 | |||
71 | m_log.DebugFormat("[HGrid]: Hyperlink request"); | ||
72 | |||
73 | SimpleRegionInfo regInfo = null; | ||
74 | foreach (SimpleRegionInfo r in m_RegionsOnSim) | ||
75 | { | ||
76 | if ((r.RegionName != null) && (name != null) && (r.RegionName.ToLower() == name.ToLower())) | ||
77 | { | ||
78 | regInfo = r; | ||
79 | break; | ||
80 | } | ||
81 | } | ||
82 | |||
83 | if (regInfo == null) | ||
84 | regInfo = m_RegionsOnSim[0]; // Send out the first region | ||
85 | |||
86 | Hashtable hash = new Hashtable(); | ||
87 | hash["uuid"] = regInfo.RegionID.ToString(); | ||
88 | hash["handle"] = regInfo.RegionHandle.ToString(); | ||
89 | //m_log.Debug(">> Here " + regInfo.RegionHandle); | ||
90 | //hash["region_image"] = regInfo.RegionSettings.TerrainImageID.ToString(); | ||
91 | hash["region_name"] = regInfo.RegionName; | ||
92 | hash["internal_port"] = regInfo.InternalEndPoint.Port.ToString(); | ||
93 | //m_log.Debug(">> Here: " + regInfo.InternalEndPoint.Port); | ||
94 | |||
95 | |||
96 | XmlRpcResponse response = new XmlRpcResponse(); | ||
97 | response.Value = hash; | ||
98 | return response; | ||
99 | } | ||
100 | |||
101 | public void AddRegion(SimpleRegionInfo rinfo) | ||
102 | { | ||
103 | m_RegionsOnSim.Add(rinfo); | ||
104 | } | ||
105 | |||
106 | public void RemoveRegion(SimpleRegionInfo rinfo) | ||
107 | { | ||
108 | if (m_RegionsOnSim.Contains(rinfo)) | ||
109 | m_RegionsOnSim.Remove(rinfo); | ||
110 | } | ||
111 | } | ||
112 | } | ||
diff --git a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs index 998b322..ca45263 100644 --- a/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/InventoryServerInConnector.cs | |||
@@ -54,19 +54,20 @@ namespace OpenSim.Server.Handlers.Inventory | |||
54 | //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); | 54 | //private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME); |
55 | 55 | ||
56 | private string m_userserver_url; | 56 | private string m_userserver_url; |
57 | private string m_ConfigName = "InventoryService"; | ||
57 | 58 | ||
58 | public InventoryServiceInConnector(IConfigSource config, IHttpServer server) : | 59 | public InventoryServiceInConnector(IConfigSource config, IHttpServer server, string configName) : |
59 | base(config, server) | 60 | base(config, server, configName) |
60 | { | 61 | { |
61 | IConfig serverConfig = config.Configs["InventoryService"]; | 62 | IConfig serverConfig = config.Configs[m_ConfigName]; |
62 | if (serverConfig == null) | 63 | if (serverConfig == null) |
63 | throw new Exception("No section 'InventoryService' in config file"); | 64 | throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName)); |
64 | 65 | ||
65 | string inventoryService = serverConfig.GetString("LocalServiceModule", | 66 | string inventoryService = serverConfig.GetString("LocalServiceModule", |
66 | String.Empty); | 67 | String.Empty); |
67 | 68 | ||
68 | if (inventoryService == String.Empty) | 69 | if (inventoryService == String.Empty) |
69 | throw new Exception("No InventoryService in config file"); | 70 | throw new Exception("No LocalServiceModule in config file"); |
70 | 71 | ||
71 | Object[] args = new Object[] { config }; | 72 | Object[] args = new Object[] { config }; |
72 | m_InventoryService = | 73 | m_InventoryService = |
diff --git a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs index 10e3b47..d368bd3 100644 --- a/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Land/LandServiceInConnector.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Land | |||
46 | // TODO : private IAuthenticationService m_AuthenticationService; | 46 | // TODO : private IAuthenticationService m_AuthenticationService; |
47 | 47 | ||
48 | public LandServiceInConnector(IConfigSource source, IHttpServer server, ILandService service, IScene scene) : | 48 | public LandServiceInConnector(IConfigSource source, IHttpServer server, ILandService service, IScene scene) : |
49 | base(source, server) | 49 | base(source, server, String.Empty) |
50 | { | 50 | { |
51 | m_LandService = service; | 51 | m_LandService = service; |
52 | if (m_LandService == null) | 52 | if (m_LandService == null) |
diff --git a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs index b3a91cf..ac2e75f 100644 --- a/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Neighbour/NeighbourServiceInConnector.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Server.Handlers.Neighbour | |||
46 | private IAuthenticationService m_AuthenticationService = null; | 46 | private IAuthenticationService m_AuthenticationService = null; |
47 | 47 | ||
48 | public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) : | 48 | public NeighbourServiceInConnector(IConfigSource source, IHttpServer server, INeighbourService nService, IScene scene) : |
49 | base(source, server) | 49 | base(source, server, String.Empty) |
50 | { | 50 | { |
51 | 51 | ||
52 | m_NeighbourService = nService; | 52 | m_NeighbourService = nService; |
diff --git a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs index 0bb4713..fe93fa5 100644 --- a/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs +++ b/OpenSim/Server/Handlers/Simulation/SimulationServiceInConnector.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.Server.Handlers.Simulation | |||
41 | private IAuthenticationService m_AuthenticationService; | 41 | private IAuthenticationService m_AuthenticationService; |
42 | 42 | ||
43 | public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : | 43 | public SimulationServiceInConnector(IConfigSource config, IHttpServer server, IScene scene) : |
44 | base(config, server) | 44 | base(config, server, String.Empty) |
45 | { | 45 | { |
46 | IConfig serverConfig = config.Configs["SimulationService"]; | 46 | IConfig serverConfig = config.Configs["SimulationService"]; |
47 | if (serverConfig == null) | 47 | if (serverConfig == null) |
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs index 77dfebb..a7b33c9 100644 --- a/OpenSim/Server/ServerMain.cs +++ b/OpenSim/Server/ServerMain.cs | |||
@@ -30,6 +30,7 @@ using log4net; | |||
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System; | 31 | using System; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using OpenSim.Framework.Servers.HttpServer; | ||
33 | using OpenSim.Server.Base; | 34 | using OpenSim.Server.Base; |
34 | using OpenSim.Server.Handlers.Base; | 35 | using OpenSim.Server.Handlers.Base; |
35 | 36 | ||
@@ -60,22 +61,59 @@ namespace OpenSim.Server | |||
60 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); | 61 | string connList = serverConfig.GetString("ServiceConnectors", String.Empty); |
61 | string[] conns = connList.Split(new char[] {',', ' '}); | 62 | string[] conns = connList.Split(new char[] {',', ' '}); |
62 | 63 | ||
63 | foreach (string conn in conns) | 64 | int i = 0; |
65 | foreach (string c in conns) | ||
64 | { | 66 | { |
65 | if (conn == String.Empty) | 67 | if (c == String.Empty) |
66 | continue; | 68 | continue; |
67 | 69 | ||
70 | string configName = String.Empty; | ||
71 | string conn = c; | ||
72 | uint port = 0; | ||
73 | |||
74 | string[] split1 = conn.Split(new char[] {'/'}); | ||
75 | if (split1.Length > 1) | ||
76 | { | ||
77 | conn = split1[1]; | ||
78 | |||
79 | string[] split2 = split1[0].Split(new char[] {'@'}); | ||
80 | if (split2.Length > 1) | ||
81 | { | ||
82 | configName = split2[0]; | ||
83 | port = Convert.ToUInt32(split2[1]); | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | port = Convert.ToUInt32(split1[0]); | ||
88 | } | ||
89 | } | ||
68 | string[] parts = conn.Split(new char[] {':'}); | 90 | string[] parts = conn.Split(new char[] {':'}); |
69 | string friendlyName = parts[0]; | 91 | string friendlyName = parts[0]; |
70 | if (parts.Length > 1) | 92 | if (parts.Length > 1) |
71 | friendlyName = parts[1]; | 93 | friendlyName = parts[1]; |
72 | 94 | ||
73 | m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); | 95 | IHttpServer server = m_Server.HttpServer; |
96 | if (port != 0) | ||
97 | server = m_Server.GetHttpServer(port); | ||
74 | 98 | ||
75 | Object[] modargs = new Object[] { m_Server.Config, m_Server.HttpServer }; | 99 | if (port != m_Server.DefaultPort) |
76 | IServiceConnector connector = | 100 | m_log.InfoFormat("[SERVER]: Loading {0} on port {1}", friendlyName, port); |
77 | ServerUtils.LoadPlugin<IServiceConnector>(conn, | 101 | else |
102 | m_log.InfoFormat("[SERVER]: Loading {0}", friendlyName); | ||
103 | |||
104 | IServiceConnector connector = null; | ||
105 | |||
106 | Object[] modargs = new Object[] { m_Server.Config, server, | ||
107 | configName }; | ||
108 | connector = ServerUtils.LoadPlugin<IServiceConnector>(conn, | ||
78 | modargs); | 109 | modargs); |
110 | if (connector == null) | ||
111 | { | ||
112 | modargs = new Object[] { m_Server.Config, server }; | ||
113 | connector = | ||
114 | ServerUtils.LoadPlugin<IServiceConnector>(conn, | ||
115 | modargs); | ||
116 | } | ||
79 | 117 | ||
80 | if (connector != null) | 118 | if (connector != null) |
81 | { | 119 | { |