diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs | 228 |
1 files changed, 228 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs new file mode 100644 index 0000000..4701ee6 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/UserProfiles/LocalUserProfilesServiceConnector.cs | |||
@@ -0,0 +1,228 @@ | |||
1 | |||
2 | /* | ||
3 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
4 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
5 | * | ||
6 | * Redistribution and use in source and binary forms, with or without | ||
7 | * modification, are permitted provided that the following conditions are met: | ||
8 | * * Redistributions of source code must retain the above copyright | ||
9 | * notice, this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright | ||
11 | * notice, this list of conditions and the following disclaimer in the | ||
12 | * documentation and/or other materials provided with the distribution. | ||
13 | * * Neither the name of the OpenSimulator Project nor the | ||
14 | * names of its contributors may be used to endorse or promote products | ||
15 | * derived from this software without specific prior written permission. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
20 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | */ | ||
28 | |||
29 | using log4net; | ||
30 | using Mono.Addins; | ||
31 | using Nini.Config; | ||
32 | using System; | ||
33 | using System.Collections.Generic; | ||
34 | using System.Reflection; | ||
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Framework.Console; | ||
37 | using OpenSim.Server.Base; | ||
38 | using OpenSim.Server.Handlers; | ||
39 | using OpenSim.Region.Framework.Interfaces; | ||
40 | using OpenSim.Framework.Servers.HttpServer; | ||
41 | using OpenSim.Framework.Servers; | ||
42 | using OpenSim.Region.Framework.Scenes; | ||
43 | using OpenSim.Services.Interfaces; | ||
44 | using GridRegion = OpenSim.Services.Interfaces.GridRegion; | ||
45 | using OpenMetaverse; | ||
46 | |||
47 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Profile | ||
48 | { | ||
49 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LocalUserProfilesServicesConnector")] | ||
50 | public class LocalUserProfilesServicesConnector : ISharedRegionModule | ||
51 | { | ||
52 | private static readonly ILog m_log = | ||
53 | LogManager.GetLogger( | ||
54 | MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | |||
56 | private Dictionary<UUID, Scene> regions = new Dictionary<UUID, Scene>(); | ||
57 | |||
58 | public IUserProfilesService ServiceModule | ||
59 | { | ||
60 | get; private set; | ||
61 | } | ||
62 | |||
63 | public bool Enabled | ||
64 | { | ||
65 | get; private set; | ||
66 | } | ||
67 | |||
68 | public string Name | ||
69 | { | ||
70 | get | ||
71 | { | ||
72 | return "LocalUserProfilesServicesConnector"; | ||
73 | } | ||
74 | } | ||
75 | |||
76 | public string ConfigName | ||
77 | { | ||
78 | get; private set; | ||
79 | } | ||
80 | |||
81 | public Type ReplaceableInterface | ||
82 | { | ||
83 | get { return null; } | ||
84 | } | ||
85 | |||
86 | public LocalUserProfilesServicesConnector() | ||
87 | { | ||
88 | m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector no params"); | ||
89 | } | ||
90 | |||
91 | public LocalUserProfilesServicesConnector(IConfigSource source) | ||
92 | { | ||
93 | m_log.Debug("[LOCAL USERPROFILES SERVICE CONNECTOR]: LocalUserProfileServicesConnector instantiated directly."); | ||
94 | InitialiseService(source); | ||
95 | } | ||
96 | |||
97 | public void InitialiseService(IConfigSource source) | ||
98 | { | ||
99 | ConfigName = "UserProfilesService"; | ||
100 | |||
101 | // Instantiate the request handler | ||
102 | IHttpServer Server = MainServer.Instance; | ||
103 | |||
104 | IConfig config = source.Configs[ConfigName]; | ||
105 | if (config == null) | ||
106 | { | ||
107 | m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini"); | ||
108 | return; | ||
109 | } | ||
110 | |||
111 | if(!config.GetBoolean("Enabled",false)) | ||
112 | { | ||
113 | Enabled = false; | ||
114 | return; | ||
115 | } | ||
116 | |||
117 | Enabled = true; | ||
118 | |||
119 | string serviceDll = config.GetString("LocalServiceModule", | ||
120 | String.Empty); | ||
121 | |||
122 | if (serviceDll == String.Empty) | ||
123 | { | ||
124 | m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: No LocalServiceModule named in section UserProfilesService"); | ||
125 | return; | ||
126 | } | ||
127 | |||
128 | Object[] args = new Object[] { source, ConfigName }; | ||
129 | ServiceModule = | ||
130 | ServerUtils.LoadPlugin<IUserProfilesService>(serviceDll, | ||
131 | args); | ||
132 | |||
133 | if (ServiceModule == null) | ||
134 | { | ||
135 | m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: Can't load user profiles service"); | ||
136 | return; | ||
137 | } | ||
138 | |||
139 | Enabled = true; | ||
140 | |||
141 | JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule); | ||
142 | |||
143 | Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest); | ||
144 | Server.AddJsonRPCHandler("classified_update", handler.ClassifiedUpdate); | ||
145 | Server.AddJsonRPCHandler("classifieds_info_query", handler.ClassifiedInfoRequest); | ||
146 | Server.AddJsonRPCHandler("classified_delete", handler.ClassifiedDelete); | ||
147 | Server.AddJsonRPCHandler("avatarpicksrequest", handler.AvatarPicksRequest); | ||
148 | Server.AddJsonRPCHandler("pickinforequest", handler.PickInfoRequest); | ||
149 | Server.AddJsonRPCHandler("picks_update", handler.PicksUpdate); | ||
150 | Server.AddJsonRPCHandler("picks_delete", handler.PicksDelete); | ||
151 | Server.AddJsonRPCHandler("avatarnotesrequest", handler.AvatarNotesRequest); | ||
152 | Server.AddJsonRPCHandler("avatar_notes_update", handler.NotesUpdate); | ||
153 | Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); | ||
154 | Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); | ||
155 | Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); | ||
156 | Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate); | ||
157 | Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest); | ||
158 | Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); | ||
159 | Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); | ||
160 | Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); | ||
161 | |||
162 | } | ||
163 | |||
164 | #region ISharedRegionModule implementation | ||
165 | |||
166 | void ISharedRegionModule.PostInitialise() | ||
167 | { | ||
168 | if(!Enabled) | ||
169 | return; | ||
170 | } | ||
171 | |||
172 | #endregion | ||
173 | |||
174 | #region IRegionModuleBase implementation | ||
175 | |||
176 | void IRegionModuleBase.Initialise(IConfigSource source) | ||
177 | { | ||
178 | IConfig moduleConfig = source.Configs["Modules"]; | ||
179 | if (moduleConfig != null) | ||
180 | { | ||
181 | string name = moduleConfig.GetString("UserProfilesServices", ""); | ||
182 | if (name == Name) | ||
183 | { | ||
184 | InitialiseService(source); | ||
185 | m_log.Info("[LOCAL USERPROFILES SERVICE CONNECTOR]: Local user profiles connector enabled"); | ||
186 | } | ||
187 | } | ||
188 | } | ||
189 | |||
190 | void IRegionModuleBase.Close() | ||
191 | { | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | void IRegionModuleBase.AddRegion(Scene scene) | ||
196 | { | ||
197 | if (!Enabled) | ||
198 | return; | ||
199 | |||
200 | lock (regions) | ||
201 | { | ||
202 | if (regions.ContainsKey(scene.RegionInfo.RegionID)) | ||
203 | m_log.ErrorFormat("[LOCAL USERPROFILES SERVICE CONNECTOR]: simulator seems to have more than one region with the same UUID. Please correct this!"); | ||
204 | else | ||
205 | regions.Add(scene.RegionInfo.RegionID, scene); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | void IRegionModuleBase.RemoveRegion(Scene scene) | ||
210 | { | ||
211 | if (!Enabled) | ||
212 | return; | ||
213 | |||
214 | lock (regions) | ||
215 | { | ||
216 | if (regions.ContainsKey(scene.RegionInfo.RegionID)) | ||
217 | regions.Remove(scene.RegionInfo.RegionID); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | void IRegionModuleBase.RegionLoaded(Scene scene) | ||
222 | { | ||
223 | if (!Enabled) | ||
224 | return; | ||
225 | } | ||
226 | #endregion | ||
227 | } | ||
228 | } \ No newline at end of file | ||