aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs43
-rw-r--r--OpenSim/Grid/UserServer/Main.cs64
-rw-r--r--OpenSim/Grid/UserServer/UserServerCommandModule.cs27
3 files changed, 99 insertions, 35 deletions
diff --git a/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs b/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs
index 1fcc623..ef59cac 100644
--- a/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs
+++ b/OpenSim/Grid/UserServer.Modules/UserDataBaseService.cs
@@ -35,11 +35,14 @@ 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{
41 public class UserDataBaseService : UserManagerBase 42 public class UserDataBaseService : UserManagerBase
42 { 43 {
44 protected IUGAIMCore m_core;
45
43 public UserDataBaseService() 46 public UserDataBaseService()
44 : base(null) 47 : base(null)
45 { 48 {
@@ -50,6 +53,46 @@ namespace OpenSim.Grid.UserServer.Modules
50 { 53 {
51 } 54 }
52 55
56 public void Initialise(IUGAIMCore core)
57 {
58 m_core = core;
59
60 //we only need core components so we can request them from here
61 IInterServiceInventoryServices inventoryService;
62 if (m_core.TryGet<IInterServiceInventoryServices>(out inventoryService))
63 {
64 m_interServiceInventoryService = inventoryService;
65 }
66
67 UserConfig cfg;
68 if (m_core.TryGet<UserConfig>(out cfg))
69 {
70 AddPlugin(cfg.DatabaseProvider, cfg.DatabaseConnect);
71 }
72
73 m_core.RegisterInterface<UserDataBaseService>(this);
74 }
75
76 public void PostInitialise()
77 {
78 }
79
80 public void RegisterHandlers(BaseHttpServer httpServer)
81 {
82 }
83
84 public UserAgentData GetUserAgentData(UUID AgentID)
85 {
86 UserProfileData userProfile = GetUserProfile(AgentID);
87
88 if (userProfile != null)
89 {
90 return userProfile.CurrentAgent;
91 }
92
93 return null;
94 }
95
53 public override UserProfileData SetupMasterUser(string firstName, string lastName) 96 public override UserProfileData SetupMasterUser(string firstName, string lastName)
54 { 97 {
55 throw new Exception("The method or operation is not implemented."); 98 throw new Exception("The method or operation is not implemented.");
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 10235ab..e174b2d 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -97,24 +97,40 @@ namespace OpenSim.Grid.UserServer
97 97
98 protected override void StartupSpecific() 98 protected override void StartupSpecific()
99 { 99 {
100 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 100 IInterServiceInventoryServices inventoryService = SetupRegisterCoreComponents();
101 101
102 m_stats = StatsManager.StartCollectingUserStats(); 102 m_stats = StatsManager.StartCollectingUserStats();
103 103
104 m_log.Info("[STARTUP]: Establishing data connection"); 104 m_log.Info("[STARTUP]: Establishing data connection");
105
106 IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
107
108 //setup database access service 105 //setup database access service
109 m_userDataBaseService = new UserDataBaseService(inventoryService); 106 m_userDataBaseService = new UserDataBaseService();
110 m_userDataBaseService.AddPlugin(Cfg.DatabaseProvider, Cfg.DatabaseConnect); 107 m_userDataBaseService.Initialise(this);
111
112 //Register the database access service so modules can fetch it
113 // RegisterInterface<UserDataBaseService>(m_userDataBaseService);
114 108
115 //setup services/modules 109 //setup services/modules
116 StartupUserServerModules(); 110 StartupUserServerModules();
117 111
112 StartOtherComponents(inventoryService);
113
114 m_consoleCommandModule = new UserServerCommandModule(m_loginService);
115 m_consoleCommandModule.Initialise(this);
116
117 //register event handlers
118 RegisterEventHandlers();
119
120 //PostInitialise the modules
121 m_consoleCommandModule.PostInitialise(); //it will register its Console command handlers in here
122 m_userDataBaseService.PostInitialise();
123
124 //register http handlers and start http server
125 m_log.Info("[STARTUP]: Starting HTTP process");
126 RegisterHttpHandlers();
127 m_httpServer.Start();
128
129 base.StartupSpecific();
130 }
131
132 private void StartOtherComponents(IInterServiceInventoryServices inventoryService)
133 {
118 m_gridInfoService = new GridInfoService(); 134 m_gridInfoService = new GridInfoService();
119 135
120 StartupLoginService(inventoryService); 136 StartupLoginService(inventoryService);
@@ -124,26 +140,21 @@ namespace OpenSim.Grid.UserServer
124 m_loginService.setloginlevel((int)Cfg.DefaultUserLevel); 140 m_loginService.setloginlevel((int)Cfg.DefaultUserLevel);
125 141
126 m_messagesService = new MessageServersConnector(); 142 m_messagesService = new MessageServersConnector();
143 }
127 144
128 m_consoleCommandModule = new UserServerCommandModule(Cfg, m_userDataBaseService, m_loginService); 145 private IInterServiceInventoryServices SetupRegisterCoreComponents()
129 m_consoleCommandModule.Initialise(this); 146 {
130 147 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
131 //PostInitialise the modules
132 m_consoleCommandModule.PostInitialise();
133 148
134 //register event handlers 149 IInterServiceInventoryServices inventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
135 RegisterEventHandlers();
136 150
137 //register http handlers and start http server
138 m_log.Info("[STARTUP]: Starting HTTP process");
139 m_httpServer = new BaseHttpServer(Cfg.HttpPort); 151 m_httpServer = new BaseHttpServer(Cfg.HttpPort);
140 RegisterHttpHandlers();
141 m_httpServer.Start();
142
143 base.StartupSpecific();
144 152
145 //register Console command handlers 153 RegisterInterface<ConsoleBase>(m_console);
146 RegisterConsoleCommands(); 154 RegisterInterface<UserConfig>(Cfg);
155 RegisterInterface<IInterServiceInventoryServices>(inventoryService);
156
157 return inventoryService;
147 } 158 }
148 159
149 /// <summary> 160 /// <summary>
@@ -178,11 +189,6 @@ namespace OpenSim.Grid.UserServer
178 m_messagesService.OnRegionShutdown += HandleRegionShutdown; 189 m_messagesService.OnRegionShutdown += HandleRegionShutdown;
179 } 190 }
180 191
181 protected virtual void RegisterConsoleCommands()
182 {
183 m_consoleCommandModule.RegisterConsoleCommands(m_console);
184 }
185
186 protected virtual void RegisterHttpHandlers() 192 protected virtual void RegisterHttpHandlers()
187 { 193 {
188 m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true); 194 m_loginService.RegisterHandlers(m_httpServer, Cfg.EnableLLSDLogin, true);
diff --git a/OpenSim/Grid/UserServer/UserServerCommandModule.cs b/OpenSim/Grid/UserServer/UserServerCommandModule.cs
index d923c9a..41a7eed 100644
--- a/OpenSim/Grid/UserServer/UserServerCommandModule.cs
+++ b/OpenSim/Grid/UserServer/UserServerCommandModule.cs
@@ -50,7 +50,7 @@ namespace OpenSim.Grid.UserServer
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 protected ConsoleBase m_console; 52 protected ConsoleBase m_console;
53 protected UserConfig Cfg; 53 protected UserConfig m_cfg;
54 54
55 protected UserDataBaseService m_userDataBaseService; 55 protected UserDataBaseService m_userDataBaseService;
56 protected UserLoginService m_loginService; 56 protected UserLoginService m_loginService;
@@ -59,10 +59,8 @@ namespace OpenSim.Grid.UserServer
59 59
60 protected IUGAIMCore m_core; 60 protected IUGAIMCore m_core;
61 61
62 public UserServerCommandModule(UserConfig cfg, UserDataBaseService userDBservice, UserLoginService loginService) 62 public UserServerCommandModule( UserLoginService loginService)
63 { 63 {
64 Cfg = cfg;
65 m_userDataBaseService = userDBservice;
66 m_loginService = loginService; 64 m_loginService = loginService;
67 } 65 }
68 66
@@ -73,6 +71,23 @@ namespace OpenSim.Grid.UserServer
73 71
74 public void PostInitialise() 72 public void PostInitialise()
75 { 73 {
74 UserConfig cfg;
75 if (m_core.TryGet<UserConfig>(out cfg))
76 {
77 m_cfg = cfg;
78 }
79
80 UserDataBaseService userDBservice;
81 if (m_core.TryGet<UserDataBaseService>(out userDBservice))
82 {
83 m_userDataBaseService = userDBservice;
84 }
85
86 ConsoleBase console;
87 if ((m_core.TryGet<ConsoleBase>(out console)) && (m_cfg != null) && (m_userDataBaseService != null))
88 {
89 RegisterConsoleCommands(console);
90 }
76 } 91 }
77 92
78 public void RegisterHandlers(BaseHttpServer httpServer) 93 public void RegisterHandlers(BaseHttpServer httpServer)
@@ -80,7 +95,7 @@ namespace OpenSim.Grid.UserServer
80 95
81 } 96 }
82 97
83 public void RegisterConsoleCommands(ConsoleBase console) 98 private void RegisterConsoleCommands(ConsoleBase console)
84 { 99 {
85 m_console = console; 100 m_console = console;
86 m_console.Commands.AddCommand("userserver", false, "create user", 101 m_console.Commands.AddCommand("userserver", false, "create user",
@@ -279,7 +294,7 @@ namespace OpenSim.Grid.UserServer
279 // requester.ReturnResponseVal = TestResponse; 294 // requester.ReturnResponseVal = TestResponse;
280 // requester.BeginPostObject<UUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); 295 // requester.BeginPostObject<UUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
281 SynchronousRestObjectPoster.BeginPostObject<UUID, List<InventoryFolderBase>>( 296 SynchronousRestObjectPoster.BeginPostObject<UUID, List<InventoryFolderBase>>(
282 "POST", Cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser); 297 "POST", m_cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser);
283 break; 298 break;
284 299
285 case "logoff-user": 300 case "logoff-user":