aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2009-02-25 18:33:15 +0000
committerMW2009-02-25 18:33:15 +0000
commit4db232763f578048c3339e6a60fe801cc3853b3d (patch)
treec43b1442bcf1893fb83894873ddfdacdee5a5130 /OpenSim
parent* Fix my own unit test (diff)
downloadopensim-SC-4db232763f578048c3339e6a60fe801cc3853b3d.zip
opensim-SC-4db232763f578048c3339e6a60fe801cc3853b3d.tar.gz
opensim-SC-4db232763f578048c3339e6a60fe801cc3853b3d.tar.bz2
opensim-SC-4db232763f578048c3339e6a60fe801cc3853b3d.tar.xz
More refactoring of the Grid, User and Messaging servers.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/IUserService.cs12
-rw-r--r--OpenSim/Grid/Framework/IMessageRegionLookup.cs (renamed from OpenSim/Grid/Framework/IMessageRegionService.cs)76
-rw-r--r--OpenSim/Grid/Framework/IMessagingServerDiscovery.cs (renamed from OpenSim/Grid/Framework/IGridMessagingMapper.cs)80
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs6
-rw-r--r--OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs6
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs8
-rw-r--r--OpenSim/Grid/MessagingServer.Modules/MessageService.cs6
-rw-r--r--OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs77
-rw-r--r--OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs13
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserManager.cs3
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs5
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs7
-rw-r--r--OpenSim/Grid/UserServer/Main.cs167
-rw-r--r--OpenSim/Grid/UserServer/UserServerCommandModule.cs14
-rw-r--r--OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs141
15 files changed, 394 insertions, 227 deletions
diff --git a/OpenSim/Framework/Communications/IUserService.cs b/OpenSim/Framework/Communications/IUserService.cs
index 206fb1e..0846024 100644
--- a/OpenSim/Framework/Communications/IUserService.cs
+++ b/OpenSim/Framework/Communications/IUserService.cs
@@ -114,17 +114,5 @@ namespace OpenSim.Framework.Communications
114 /// </summary> 114 /// </summary>
115 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param> 115 /// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
116 List<FriendListItem> GetUserFriendList(UUID friendlistowner); 116 List<FriendListItem> GetUserFriendList(UUID friendlistowner);
117
118 /// <summary>
119 /// Get's the User Appearance
120 // AvatarAppearance GetUserAppearance(UUID user);
121
122 // void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
123
124 // void AddAttachment(UUID user, UUID attach);
125
126 // void RemoveAttachment(UUID user, UUID attach);
127
128 // List<UUID> GetAttachments(UUID user);
129 } 117 }
130} 118}
diff --git a/OpenSim/Grid/Framework/IMessageRegionService.cs b/OpenSim/Grid/Framework/IMessageRegionLookup.cs
index 8c1d15a..5e49a40 100644
--- a/OpenSim/Grid/Framework/IMessageRegionService.cs
+++ b/OpenSim/Grid/Framework/IMessageRegionLookup.cs
@@ -1,38 +1,38 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using OpenSim.Data; 29using OpenSim.Data;
30 30
31namespace OpenSim.Grid.Framework 31namespace OpenSim.Grid.Framework
32{ 32{
33 public interface IMessageRegionService 33 public interface IMessageRegionLookup
34 { 34 {
35 int ClearRegionCache(); 35 int ClearRegionCache();
36 RegionProfileData GetRegionInfo(ulong regionhandle); 36 RegionProfileData GetRegionInfo(ulong regionhandle);
37 } 37 }
38} 38}
diff --git a/OpenSim/Grid/Framework/IGridMessagingMapper.cs b/OpenSim/Grid/Framework/IMessagingServerDiscovery.cs
index 3a21431..7995aba 100644
--- a/OpenSim/Grid/Framework/IGridMessagingMapper.cs
+++ b/OpenSim/Grid/Framework/IMessagingServerDiscovery.cs
@@ -1,40 +1,40 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the 12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products 13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission. 14 * derived from this software without specific prior written permission.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY 16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using OpenSim.Framework.Servers; 30using OpenSim.Framework.Servers;
31 31
32namespace OpenSim.Grid.Framework 32namespace OpenSim.Grid.Framework
33{ 33{
34 public interface IGridMessagingMapper 34 public interface IMessagingServerDiscovery
35 { 35 {
36 List<MessageServerInfo> GetMessageServersList(); 36 List<MessageServerInfo> GetMessageServersList();
37 void RegisterMessageServer(MessageServerInfo m); 37 void RegisterMessageServer(MessageServerInfo m);
38 void DeRegisterMessageServer(MessageServerInfo m); 38 void DeRegisterMessageServer(MessageServerInfo m);
39 } 39 }
40} 40}
diff --git a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs
index ee38310..1d2c529 100644
--- a/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs
+++ b/OpenSim/Grid/GridServer.Modules/GridMessagingModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -38,7 +38,7 @@ using OpenSim.Grid.Framework;
38 38
39namespace OpenSim.Grid.GridServer.Modules 39namespace OpenSim.Grid.GridServer.Modules
40{ 40{
41 public class GridMessagingModule : IGridMessagingMapper 41 public class GridMessagingModule : IMessagingServerDiscovery
42 { 42 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
@@ -68,7 +68,7 @@ namespace OpenSim.Grid.GridServer.Modules
68 m_gridCore = gridCore; 68 m_gridCore = gridCore;
69 m_config = config; 69 m_config = config;
70 70
71 m_gridCore.RegisterInterface<IGridMessagingMapper>(this); 71 m_gridCore.RegisterInterface<IMessagingServerDiscovery>(this);
72 72
73 RegisterHandlers(); 73 RegisterHandlers();
74 } 74 }
diff --git a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs
index 292ce0d..62101e5 100644
--- a/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs
+++ b/OpenSim/Grid/GridServer.Modules/GridXmlRpcModule.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Grid.GridServer.Modules
51 51
52 protected GridConfig m_config; 52 protected GridConfig m_config;
53 53
54 protected IGridMessagingMapper m_messagingServerMapper; 54 protected IMessagingServerDiscovery m_messagingServerMapper;
55 /// <value> 55 /// <value>
56 /// Used to notify old regions as to which OpenSim version to upgrade to 56 /// Used to notify old regions as to which OpenSim version to upgrade to
57 /// </value> 57 /// </value>
@@ -80,8 +80,8 @@ namespace OpenSim.Grid.GridServer.Modules
80 80
81 public void PostInitialise() 81 public void PostInitialise()
82 { 82 {
83 IGridMessagingMapper messagingModule; 83 IMessagingServerDiscovery messagingModule;
84 if (m_gridCore.TryGet<IGridMessagingMapper>(out messagingModule)) 84 if (m_gridCore.TryGet<IMessagingServerDiscovery>(out messagingModule))
85 { 85 {
86 m_messagingServerMapper = messagingModule; 86 m_messagingServerMapper = messagingModule;
87 } 87 }
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs
index 7b3edfb..7002a2e 100644
--- a/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/MessageRegionModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -42,7 +42,7 @@ using Timer = System.Timers.Timer;
42 42
43namespace OpenSim.Grid.MessagingServer.Modules 43namespace OpenSim.Grid.MessagingServer.Modules
44{ 44{
45 public class MessageRegionModule : IMessageRegionService 45 public class MessageRegionModule : IMessageRegionLookup
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
@@ -63,7 +63,7 @@ namespace OpenSim.Grid.MessagingServer.Modules
63 63
64 public void Initialise() 64 public void Initialise()
65 { 65 {
66 m_messageCore.RegisterInterface<IMessageRegionService>(this); 66 m_messageCore.RegisterInterface<IMessageRegionLookup>(this);
67 } 67 }
68 68
69 public void PostInitialise() 69 public void PostInitialise()
@@ -210,4 +210,4 @@ namespace OpenSim.Grid.MessagingServer.Modules
210 } 210 }
211 211
212 } 212 }
213} 213} \ No newline at end of file
diff --git a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs
index c76f332..e79e5b4 100644
--- a/OpenSim/Grid/MessagingServer.Modules/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer.Modules/MessageService.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Grid.MessagingServer.Modules
52 private IUGAIMCore m_messageCore; 52 private IUGAIMCore m_messageCore;
53 53
54 private IMessageUserServerService m_userServerModule; 54 private IMessageUserServerService m_userServerModule;
55 private IMessageRegionService m_regionModule; 55 private IMessageRegionLookup m_regionModule;
56 56
57 // a dictionary of all current presences this server knows about 57 // a dictionary of all current presences this server knows about
58 private Dictionary<UUID, UserPresenceData> m_presences = new Dictionary<UUID,UserPresenceData>(); 58 private Dictionary<UUID, UserPresenceData> m_presences = new Dictionary<UUID,UserPresenceData>();
@@ -82,8 +82,8 @@ namespace OpenSim.Grid.MessagingServer.Modules
82 m_userServerModule = messageUserServer; 82 m_userServerModule = messageUserServer;
83 } 83 }
84 84
85 IMessageRegionService messageRegion; 85 IMessageRegionLookup messageRegion;
86 if (m_messageCore.TryGet<IMessageRegionService>(out messageRegion)) 86 if (m_messageCore.TryGet<IMessageRegionLookup>(out messageRegion))
87 { 87 {
88 m_regionModule = messageRegion; 88 m_regionModule = messageRegion;
89 } 89 }
diff --git a/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs b/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs
new file mode 100644
index 0000000..a6fdee0
--- /dev/null
+++ b/OpenSim/Grid/UserServer.Modules/GridInfoServiceModule.cs
@@ -0,0 +1,77 @@
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 OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using log4net.Config;
34using OpenMetaverse;
35using OpenSim.Framework;
36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Communications.Cache;
38using OpenSim.Framework.Servers;
39using OpenSim.Grid.Communications.OGS1;
40using OpenSim.Grid.Framework;
41
42namespace OpenSim.Grid.UserServer.Modules
43{
44 public class GridInfoServiceModule
45 {
46 protected IUGAIMCore m_core;
47 protected GridInfoService m_gridInfoService;
48 protected BaseHttpServer m_httpServer;
49
50 public GridInfoServiceModule()
51 {
52 }
53
54 public void Initialise(IUGAIMCore core)
55 {
56 m_core = core;
57 m_gridInfoService = new GridInfoService();
58 }
59
60 public void PostInitialise()
61 {
62
63 }
64
65 public void RegisterHandlers(BaseHttpServer httpServer)
66 {
67 m_httpServer = httpServer;
68 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info",
69 m_gridInfoService.RestGetGridInfoMethod));
70 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
71 }
72
73 public void Close()
74 {
75 }
76 }
77}
diff --git a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs
index 59e9805..5b245ee 100644
--- a/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs
+++ b/OpenSim/Grid/UserServer.Modules/MessageServersConnector.cs
@@ -35,6 +35,7 @@ using Nwc.XmlRpc;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Grid.Framework;
38 39
39namespace OpenSim.Grid.UserServer.Modules 40namespace OpenSim.Grid.UserServer.Modules
40{ 41{
@@ -78,6 +79,8 @@ namespace OpenSim.Grid.UserServer.Modules
78 79
79 Thread m_NotifyThread; 80 Thread m_NotifyThread;
80 81
82 private IUGAIMCore m_core;
83
81 public event AgentLocationDelegate OnAgentLocation; 84 public event AgentLocationDelegate OnAgentLocation;
82 public event AgentLeavingDelegate OnAgentLeaving; 85 public event AgentLeavingDelegate OnAgentLeaving;
83 public event RegionStartupDelegate OnRegionStartup; 86 public event RegionStartupDelegate OnRegionStartup;
@@ -86,18 +89,18 @@ namespace OpenSim.Grid.UserServer.Modules
86 public MessageServersConnector() 89 public MessageServersConnector()
87 { 90 {
88 MessageServers = new Dictionary<string, MessageServerInfo>(); 91 MessageServers = new Dictionary<string, MessageServerInfo>();
89 m_NotifyThread = new Thread(new ThreadStart(NotifyQueueRunner));
90 m_NotifyThread.Start();
91 } 92 }
92 93
93 public void Initialise() 94 public void Initialise(IUGAIMCore core)
94 { 95 {
95 96 m_core = core;
97 m_core.RegisterInterface<MessageServersConnector>(this);
98 m_NotifyThread = new Thread(new ThreadStart(NotifyQueueRunner));
99 m_NotifyThread.Start();
96 } 100 }
97 101
98 public void PostInitialise() 102 public void PostInitialise()
99 { 103 {
100
101 } 104 }
102 105
103 public void RegisterHandlers(BaseHttpServer httpServer) 106 public void RegisterHandlers(BaseHttpServer httpServer)
diff --git a/OpenSim/Grid/UserServer.Modules/UserManager.cs b/OpenSim/Grid/UserServer.Modules/UserManager.cs
index 1f4b07d..34daff2 100644
--- a/OpenSim/Grid/UserServer.Modules/UserManager.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserManager.cs
@@ -35,6 +35,7 @@ using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Grid.Framework;
38 39
39namespace OpenSim.Grid.UserServer.Modules 40namespace OpenSim.Grid.UserServer.Modules
40{ 41{
@@ -59,7 +60,7 @@ namespace OpenSim.Grid.UserServer.Modules
59 m_userDataBaseService = userDataBaseService; 60 m_userDataBaseService = userDataBaseService;
60 } 61 }
61 62
62 public void Initialise() 63 public void Initialise(IUGAIMCore core)
63 { 64 {
64 65
65 } 66 }
diff --git a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
index a1497b4..e68752d 100644
--- a/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserServerAvatarAppearanceModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -35,6 +35,7 @@ using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Grid.Framework;
38 39
39namespace OpenSim.Grid.UserServer.Modules 40namespace OpenSim.Grid.UserServer.Modules
40{ 41{
@@ -50,7 +51,7 @@ namespace OpenSim.Grid.UserServer.Modules
50 m_userDataBaseService = userDataBaseService; 51 m_userDataBaseService = userDataBaseService;
51 } 52 }
52 53
53 public void Initialise() 54 public void Initialise(IUGAIMCore core)
54 { 55 {
55 56
56 } 57 }
diff --git a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs b/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs
index 9711a4b..6c1daea 100644
--- a/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserServerFriendsModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -35,6 +35,7 @@ using OpenMetaverse;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Communications; 36using OpenSim.Framework.Communications;
37using OpenSim.Framework.Servers; 37using OpenSim.Framework.Servers;
38using OpenSim.Grid.Framework;
38 39
39namespace OpenSim.Grid.UserServer.Modules 40namespace OpenSim.Grid.UserServer.Modules
40{ 41{
@@ -51,7 +52,7 @@ namespace OpenSim.Grid.UserServer.Modules
51 m_userDataBaseService = userDataBaseService; 52 m_userDataBaseService = userDataBaseService;
52 } 53 }
53 54
54 public void Initialise() 55 public void Initialise(IUGAIMCore core)
55 { 56 {
56 57
57 } 58 }
@@ -170,4 +171,4 @@ namespace OpenSim.Grid.UserServer.Modules
170 return FriendListItemListtoXmlRPCResponse(returndata); 171 return FriendListItemListtoXmlRPCResponse(returndata);
171 } 172 }
172 } 173 }
173} 174} \ No newline at end of file
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index e174b2d..63d788d 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -62,10 +62,12 @@ namespace OpenSim.Grid.UserServer
62 protected UserServerFriendsModule m_friendsModule; 62 protected UserServerFriendsModule m_friendsModule;
63 63
64 public UserLoginService m_loginService; 64 public UserLoginService m_loginService;
65 public GridInfoService m_gridInfoService;
66 public MessageServersConnector m_messagesService; 65 public MessageServersConnector m_messagesService;
67 66
67 protected GridInfoServiceModule m_gridInfoService;
68
68 protected UserServerCommandModule m_consoleCommandModule; 69 protected UserServerCommandModule m_consoleCommandModule;
70 protected UserServerEventDispatchModule m_eventDispatcher;
69 71
70 public static void Main(string[] args) 72 public static void Main(string[] args)
71 { 73 {
@@ -97,62 +99,40 @@ namespace OpenSim.Grid.UserServer
97 99
98 protected override void StartupSpecific() 100 protected override void StartupSpecific()
99 { 101 {
100 IInterServiceInventoryServices inventoryService = SetupRegisterCoreComponents(); 102 IInterServiceInventoryServices inventoryService = StartupCoreComponents();
101 103
102 m_stats = StatsManager.StartCollectingUserStats(); 104 m_stats = StatsManager.StartCollectingUserStats();
103 105
104 m_log.Info("[STARTUP]: Establishing data connection");
105 //setup database access service
106 m_userDataBaseService = new UserDataBaseService();
107 m_userDataBaseService.Initialise(this);
108
109 //setup services/modules 106 //setup services/modules
110 StartupUserServerModules(); 107 StartupUserServerModules();
111 108
112 StartOtherComponents(inventoryService); 109 StartOtherComponents(inventoryService);
113 110
114 m_consoleCommandModule = new UserServerCommandModule(m_loginService);
115 m_consoleCommandModule.Initialise(this);
116
117 //register event handlers
118 RegisterEventHandlers();
119
120 //PostInitialise the modules 111 //PostInitialise the modules
121 m_consoleCommandModule.PostInitialise(); //it will register its Console command handlers in here 112 PostInitialiseModules();
122 m_userDataBaseService.PostInitialise();
123 113
124 //register http handlers and start http server 114 //register http handlers and start http server
125 m_log.Info("[STARTUP]: Starting HTTP process"); 115 m_log.Info("[STARTUP]: Starting HTTP process");
126 RegisterHttpHandlers(); 116 RegisterHttpHandlers();
127 m_httpServer.Start(); 117 m_httpServer.Start();
128
129 base.StartupSpecific();
130 }
131
132 private void StartOtherComponents(IInterServiceInventoryServices inventoryService)
133 {
134 m_gridInfoService = new GridInfoService();
135
136 StartupLoginService(inventoryService);
137 //
138 // Get the minimum defaultLevel to access to the grid
139 //
140 m_loginService.setloginlevel((int)Cfg.DefaultUserLevel);
141 118
142 m_messagesService = new MessageServersConnector(); 119 base.StartupSpecific();
143 } 120 }
144 121
145 private IInterServiceInventoryServices SetupRegisterCoreComponents() 122 protected virtual IInterServiceInventoryServices StartupCoreComponents()
146 { 123 {
147 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 124 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
148 125
149 IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
150
151 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 126 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
152 127
153 RegisterInterface<ConsoleBase>(m_console); 128 RegisterInterface<ConsoleBase>(m_console);
154 RegisterInterface<UserConfig>(Cfg); 129 RegisterInterface<UserConfig>(Cfg);
130
131 IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
132 // IRegionProfileService regionProfileService = new RegionProfileServiceProxy();
133
155 RegisterInterface<IInterServiceInventoryServices>(inventoryService); 134 RegisterInterface<IInterServiceInventoryServices>(inventoryService);
135 // RegisterInterface<IRegionProfileService>(regionProfileService);
156 136
157 return inventoryService; 137 return inventoryService;
158 } 138 }
@@ -163,9 +143,43 @@ namespace OpenSim.Grid.UserServer
163 /// <param name="inventoryService"></param> 143 /// <param name="inventoryService"></param>
164 protected virtual void StartupUserServerModules() 144 protected virtual void StartupUserServerModules()
165 { 145 {
146 m_log.Info("[STARTUP]: Establishing data connection");
147 //setup database access service, for now this has to be created before the other modules.
148 m_userDataBaseService = new UserDataBaseService();
149 m_userDataBaseService.Initialise(this);
150
151 //TODO: change these modules so they fetch the databaseService class in the PostInitialise method
166 m_userManager = new UserManager(m_userDataBaseService); 152 m_userManager = new UserManager(m_userDataBaseService);
153 m_userManager.Initialise(this);
154
167 m_avatarAppearanceModule = new UserServerAvatarAppearanceModule(m_userDataBaseService); 155 m_avatarAppearanceModule = new UserServerAvatarAppearanceModule(m_userDataBaseService);
156 m_avatarAppearanceModule.Initialise(this);
157
168 m_friendsModule = new UserServerFriendsModule(m_userDataBaseService); 158 m_friendsModule = new UserServerFriendsModule(m_userDataBaseService);
159 m_friendsModule.Initialise(this);
160
161 m_consoleCommandModule = new UserServerCommandModule();
162 m_consoleCommandModule.Initialise(this);
163
164 m_messagesService = new MessageServersConnector();
165 m_messagesService.Initialise(this);
166
167 m_gridInfoService = new GridInfoServiceModule();
168 m_gridInfoService.Initialise(this);
169 }
170
171 protected virtual void StartOtherComponents(IInterServiceInventoryServices inventoryService)
172 {
173 StartupLoginService(inventoryService);
174 //
175 // Get the minimum defaultLevel to access to the grid
176 //
177 m_loginService.setloginlevel((int)Cfg.DefaultUserLevel);
178
179 RegisterInterface<UserLoginService>(m_loginService); //TODO: should be done in the login service
180
181 m_eventDispatcher = new UserServerEventDispatchModule(m_userManager, m_messagesService, m_loginService);
182 m_eventDispatcher.Initialise(this);
169 } 183 }
170 184
171 /// <summary> 185 /// <summary>
@@ -178,34 +192,32 @@ namespace OpenSim.Grid.UserServer
178 m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy()); 192 m_userDataBaseService, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), Cfg, Cfg.DefaultStartupMsg, new RegionProfileServiceProxy());
179 } 193 }
180 194
181 protected virtual void RegisterEventHandlers() 195 protected virtual void PostInitialiseModules()
182 { 196 {
183 m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation; 197 m_consoleCommandModule.PostInitialise(); //it will register its Console command handlers in here
184 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff; 198 m_userDataBaseService.PostInitialise();
185 199 m_messagesService.PostInitialise();
186 m_messagesService.OnAgentLocation += HandleAgentLocation; 200 m_eventDispatcher.PostInitialise(); //it will register event handlers in here
187 m_messagesService.OnAgentLeaving += HandleAgentLeaving; 201 m_gridInfoService.PostInitialise();
188 m_messagesService.OnRegionStartup += HandleRegionStartup; 202 m_userManager.PostInitialise();
189 m_messagesService.OnRegionShutdown += HandleRegionShutdown; 203 m_avatarAppearanceModule.PostInitialise();
204 m_friendsModule.PostInitialise();
190 } 205 }
191 206
192 protected virtual void RegisterHttpHandlers() 207 protected virtual void RegisterHttpHandlers()
193 { 208 {
194 m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true); 209 m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true);
195 210
196 m_userManager.RegisterHandlers(m_httpServer); 211 m_userManager.RegisterHandlers(m_httpServer);
197 m_friendsModule.RegisterHandlers(m_httpServer); 212 m_friendsModule.RegisterHandlers(m_httpServer);
198 m_avatarAppearanceModule.RegisterHandlers(m_httpServer); 213 m_avatarAppearanceModule.RegisterHandlers(m_httpServer);
199 m_messagesService.RegisterHandlers(m_httpServer); 214 m_messagesService.RegisterHandlers(m_httpServer);
200 215 m_gridInfoService.RegisterHandlers(m_httpServer);
201 m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info",
202 m_gridInfoService.RestGetGridInfoMethod));
203 m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
204 } 216 }
205 217
206 public override void ShutdownSpecific() 218 public override void ShutdownSpecific()
207 { 219 {
208 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation; 220 m_eventDispatcher.Close();
209 } 221 }
210 222
211 #region IUGAIMCore 223 #region IUGAIMCore
@@ -247,74 +259,11 @@ namespace OpenSim.Grid.UserServer
247 { 259 {
248 return m_httpServer; 260 return m_httpServer;
249 } 261 }
250
251
252 #endregion
253
254 #region Console Command Handlers
255
256 protected override void ShowHelp(string[] helpArgs)
257 {
258 base.ShowHelp(helpArgs);
259 }
260 #endregion 262 #endregion
261 263
262 public void TestResponse(List<InventoryFolderBase> resp) 264 public void TestResponse(List<InventoryFolderBase> resp)
263 { 265 {
264 m_console.Notice("response got"); 266 m_console.Notice("response got");
265 } 267 }
266
267 #region Event Handlers
268 public void NotifyMessageServersUserLoggOff(UUID agentID)
269 {
270 m_messagesService.TellMessageServersAboutUserLogoff(agentID);
271 }
272
273 public void NotifyMessageServersUserLoggedInToLocation(UUID agentID, UUID sessionID, UUID RegionID,
274 ulong regionhandle, float positionX, float positionY,
275 float positionZ, string firstname, string lastname)
276 {
277 m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
278 positionY, positionZ, firstname, lastname);
279 }
280
281 public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle)
282 {
283 m_userManager.HandleAgentLocation(agentID, regionID, regionHandle);
284 }
285
286 public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle)
287 {
288 m_userManager.HandleAgentLeaving(agentID, regionID, regionHandle);
289 }
290
291 public void HandleRegionStartup(UUID regionID)
292 {
293 // This might seem strange, that we send this back to the
294 // server it came from. But there is method to the madness.
295 // There can be multiple user servers on the same database,
296 // and each can have multiple messaging servers. So, we send
297 // it to all known user servers, who send it to all known
298 // message servers. That way, we should be able to finally
299 // update presence to all regions and thereby all friends
300 //
301 m_userManager.HandleRegionStartup(regionID);
302 m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
303 }
304
305 public void HandleRegionShutdown(UUID regionID)
306 {
307 // This might seem strange, that we send this back to the
308 // server it came from. But there is method to the madness.
309 // There can be multiple user servers on the same database,
310 // and each can have multiple messaging servers. So, we send
311 // it to all known user servers, who send it to all known
312 // message servers. That way, we should be able to finally
313 // update presence to all regions and thereby all friends
314 //
315 m_userManager.HandleRegionShutdown(regionID);
316 m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
317 }
318 #endregion
319 } 268 }
320} 269}
diff --git a/OpenSim/Grid/UserServer/UserServerCommandModule.cs b/OpenSim/Grid/UserServer/UserServerCommandModule.cs
index f35cfec..a6f8af2 100644
--- a/OpenSim/Grid/UserServer/UserServerCommandModule.cs
+++ b/OpenSim/Grid/UserServer/UserServerCommandModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -59,9 +59,8 @@ namespace OpenSim.Grid.UserServer
59 59
60 protected IUGAIMCore m_core; 60 protected IUGAIMCore m_core;
61 61
62 public UserServerCommandModule( UserLoginService loginService) 62 public UserServerCommandModule()
63 { 63 {
64 m_loginService = loginService;
65 } 64 }
66 65
67 public void Initialise(IUGAIMCore core) 66 public void Initialise(IUGAIMCore core)
@@ -83,8 +82,15 @@ namespace OpenSim.Grid.UserServer
83 m_userDataBaseService = userDBservice; 82 m_userDataBaseService = userDBservice;
84 } 83 }
85 84
85 UserLoginService loginService;
86 if (m_core.TryGet<UserLoginService>(out loginService))
87 {
88 m_loginService = loginService;
89 }
90
86 ConsoleBase console; 91 ConsoleBase console;
87 if ((m_core.TryGet<ConsoleBase>(out console)) && (m_cfg != null) && (m_userDataBaseService != null)) 92 if ((m_core.TryGet<ConsoleBase>(out console)) && (m_cfg != null)
93 && (m_userDataBaseService != null) && (m_loginService != null))
88 { 94 {
89 RegisterConsoleCommands(console); 95 RegisterConsoleCommands(console);
90 } 96 }
diff --git a/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs b/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs
new file mode 100644
index 0000000..e23a7d1
--- /dev/null
+++ b/OpenSim/Grid/UserServer/UserServerEventDispatchModule.cs
@@ -0,0 +1,141 @@
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 OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using log4net;
33using log4net.Config;
34using OpenMetaverse;
35using OpenSim.Data;
36using OpenSim.Framework;
37using OpenSim.Framework.Communications;
38using OpenSim.Framework.Communications.Cache;
39using OpenSim.Framework.Console;
40using OpenSim.Framework.Servers;
41using OpenSim.Framework.Statistics;
42using OpenSim.Grid.Communications.OGS1;
43using OpenSim.Grid.Framework;
44using OpenSim.Grid.UserServer.Modules;
45
46namespace OpenSim.Grid.UserServer
47{
48 //Do we actually need these event dispatchers?
49 //shouldn't the other modules just directly register event handlers to each other?
50 public class UserServerEventDispatchModule
51 {
52 protected UserManager m_userManager;
53 protected MessageServersConnector m_messagesService;
54 protected UserLoginService m_loginService;
55
56 public UserServerEventDispatchModule(UserManager userManager, MessageServersConnector messagesService, UserLoginService loginService)
57 {
58 m_userManager = userManager;
59 m_messagesService = messagesService;
60 m_loginService = loginService;
61 }
62
63 public void Initialise(IUGAIMCore core)
64 {
65 }
66
67 public void PostInitialise()
68 {
69 m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
70 m_userManager.OnLogOffUser += NotifyMessageServersUserLoggOff;
71
72 m_messagesService.OnAgentLocation += HandleAgentLocation;
73 m_messagesService.OnAgentLeaving += HandleAgentLeaving;
74 m_messagesService.OnRegionStartup += HandleRegionStartup;
75 m_messagesService.OnRegionShutdown += HandleRegionShutdown;
76 }
77
78 public void RegisterHandlers(BaseHttpServer httpServer)
79 {
80
81 }
82
83 public void Close()
84 {
85 m_loginService.OnUserLoggedInAtLocation -= NotifyMessageServersUserLoggedInToLocation;
86 }
87
88 #region Event Handlers
89 public void NotifyMessageServersUserLoggOff(UUID agentID)
90 {
91 m_messagesService.TellMessageServersAboutUserLogoff(agentID);
92 }
93
94 public void NotifyMessageServersUserLoggedInToLocation(UUID agentID, UUID sessionID, UUID RegionID,
95 ulong regionhandle, float positionX, float positionY,
96 float positionZ, string firstname, string lastname)
97 {
98 m_messagesService.TellMessageServersAboutUser(agentID, sessionID, RegionID, regionhandle, positionX,
99 positionY, positionZ, firstname, lastname);
100 }
101
102 public void HandleAgentLocation(UUID agentID, UUID regionID, ulong regionHandle)
103 {
104 m_userManager.HandleAgentLocation(agentID, regionID, regionHandle);
105 }
106
107 public void HandleAgentLeaving(UUID agentID, UUID regionID, ulong regionHandle)
108 {
109 m_userManager.HandleAgentLeaving(agentID, regionID, regionHandle);
110 }
111
112 public void HandleRegionStartup(UUID regionID)
113 {
114 // This might seem strange, that we send this back to the
115 // server it came from. But there is method to the madness.
116 // There can be multiple user servers on the same database,
117 // and each can have multiple messaging servers. So, we send
118 // it to all known user servers, who send it to all known
119 // message servers. That way, we should be able to finally
120 // update presence to all regions and thereby all friends
121 //
122 m_userManager.HandleRegionStartup(regionID);
123 m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
124 }
125
126 public void HandleRegionShutdown(UUID regionID)
127 {
128 // This might seem strange, that we send this back to the
129 // server it came from. But there is method to the madness.
130 // There can be multiple user servers on the same database,
131 // and each can have multiple messaging servers. So, we send
132 // it to all known user servers, who send it to all known
133 // message servers. That way, we should be able to finally
134 // update presence to all regions and thereby all friends
135 //
136 m_userManager.HandleRegionShutdown(regionID);
137 m_messagesService.TellMessageServersAboutRegionShutdown(regionID);
138 }
139 #endregion
140 }
141}