diff options
More work on modulising the User Server.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Grid/UserServer/Main.cs | 64 |
1 files changed, 35 insertions, 29 deletions
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); |