diff options
author | Melanie | 2013-06-04 21:09:25 +0100 |
---|---|---|
committer | Melanie | 2013-06-04 21:09:25 +0100 |
commit | 648e258b8e79e52df18f41f2ec79016a095f7766 (patch) | |
tree | de96993d11a0183ac026cec61e0e5a937f801c3c /OpenSim/Services | |
parent | Merge branch 'master' into careminster (diff) | |
parent | New HttpServer_OpenSim.dll with increased limits on number of connections, re... (diff) | |
download | opensim-SC-648e258b8e79e52df18f41f2ec79016a095f7766.zip opensim-SC-648e258b8e79e52df18f41f2ec79016a095f7766.tar.gz opensim-SC-648e258b8e79e52df18f41f2ec79016a095f7766.tar.bz2 opensim-SC-648e258b8e79e52df18f41f2ec79016a095f7766.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
Diffstat (limited to 'OpenSim/Services')
3 files changed, 348 insertions, 0 deletions
diff --git a/OpenSim/Services/Interfaces/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs new file mode 100644 index 0000000..319d307 --- /dev/null +++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs | |||
@@ -0,0 +1,75 @@ | |||
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 OpenSim.Framework; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.StructuredData; | ||
32 | |||
33 | namespace OpenSim.Services.Interfaces | ||
34 | { | ||
35 | public interface IUserProfilesService | ||
36 | { | ||
37 | #region Classifieds | ||
38 | OSD AvatarClassifiedsRequest(UUID creatorId); | ||
39 | bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result); | ||
40 | bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result); | ||
41 | bool ClassifiedDelete(UUID recordId); | ||
42 | #endregion Classifieds | ||
43 | |||
44 | #region Picks | ||
45 | OSD AvatarPicksRequest(UUID creatorId); | ||
46 | bool PickInfoRequest(ref UserProfilePick pick, ref string result); | ||
47 | bool PicksUpdate(ref UserProfilePick pick, ref string result); | ||
48 | bool PicksDelete(UUID pickId); | ||
49 | #endregion Picks | ||
50 | |||
51 | #region Notes | ||
52 | bool AvatarNotesRequest(ref UserProfileNotes note); | ||
53 | bool NotesUpdate(ref UserProfileNotes note, ref string result); | ||
54 | #endregion Notes | ||
55 | |||
56 | #region Profile Properties | ||
57 | bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result); | ||
58 | bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result); | ||
59 | #endregion Profile Properties | ||
60 | |||
61 | #region Interests | ||
62 | bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result); | ||
63 | #endregion Interests | ||
64 | |||
65 | #region Utility | ||
66 | OSD AvatarImageAssetsRequest(UUID avatarId); | ||
67 | #endregion Utility | ||
68 | |||
69 | #region UserData | ||
70 | bool RequestUserAppData(ref UserAppData prop, ref string result); | ||
71 | bool SetUserAppData(UserAppData prop, ref string result); | ||
72 | #endregion UserData | ||
73 | } | ||
74 | } | ||
75 | |||
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs new file mode 100644 index 0000000..d00f34d --- /dev/null +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs | |||
@@ -0,0 +1,187 @@ | |||
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.Reflection; | ||
30 | using System.Text; | ||
31 | using Nini.Config; | ||
32 | using log4net; | ||
33 | using OpenSim.Server.Base; | ||
34 | using OpenSim.Services.Interfaces; | ||
35 | using OpenSim.Services.UserAccountService; | ||
36 | using OpenSim.Data; | ||
37 | using OpenMetaverse; | ||
38 | using OpenMetaverse.StructuredData; | ||
39 | using OpenSim.Framework; | ||
40 | |||
41 | namespace OpenSim.Services.ProfilesService | ||
42 | { | ||
43 | public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService | ||
44 | { | ||
45 | static readonly ILog m_log = | ||
46 | LogManager.GetLogger( | ||
47 | MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | IUserAccountService userAccounts; | ||
50 | IAuthenticationService authService; | ||
51 | |||
52 | public UserProfilesService(IConfigSource config, string configName): | ||
53 | base(config, configName) | ||
54 | { | ||
55 | IConfig Config = config.Configs[configName]; | ||
56 | if (Config == null) | ||
57 | { | ||
58 | m_log.Warn("[PROFILES]: No configuration found!"); | ||
59 | return; | ||
60 | } | ||
61 | Object[] args = null; | ||
62 | |||
63 | args = new Object[] { config }; | ||
64 | string accountService = Config.GetString("UserAccountService", String.Empty); | ||
65 | if (accountService != string.Empty) | ||
66 | userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args); | ||
67 | |||
68 | args = new Object[] { config }; | ||
69 | string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty); | ||
70 | if (accountService != string.Empty) | ||
71 | authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args); | ||
72 | } | ||
73 | |||
74 | #region Classifieds | ||
75 | public OSD AvatarClassifiedsRequest(UUID creatorId) | ||
76 | { | ||
77 | OSDArray records = ProfilesData.GetClassifiedRecords(creatorId); | ||
78 | |||
79 | return records; | ||
80 | } | ||
81 | |||
82 | public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result) | ||
83 | { | ||
84 | if(!ProfilesData.UpdateClassifiedRecord(ad, ref result)) | ||
85 | { | ||
86 | return false; | ||
87 | } | ||
88 | result = "success"; | ||
89 | return true; | ||
90 | } | ||
91 | |||
92 | public bool ClassifiedDelete(UUID recordId) | ||
93 | { | ||
94 | if(ProfilesData.DeleteClassifiedRecord(recordId)) | ||
95 | return true; | ||
96 | |||
97 | return false; | ||
98 | } | ||
99 | |||
100 | public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result) | ||
101 | { | ||
102 | if(ProfilesData.GetClassifiedInfo(ref ad, ref result)) | ||
103 | return true; | ||
104 | |||
105 | return false; | ||
106 | } | ||
107 | #endregion Classifieds | ||
108 | |||
109 | #region Picks | ||
110 | public OSD AvatarPicksRequest(UUID creatorId) | ||
111 | { | ||
112 | OSDArray records = ProfilesData.GetAvatarPicks(creatorId); | ||
113 | |||
114 | return records; | ||
115 | } | ||
116 | |||
117 | public bool PickInfoRequest(ref UserProfilePick pick, ref string result) | ||
118 | { | ||
119 | pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId); | ||
120 | result = "OK"; | ||
121 | return true; | ||
122 | } | ||
123 | |||
124 | public bool PicksUpdate(ref UserProfilePick pick, ref string result) | ||
125 | { | ||
126 | return ProfilesData.UpdatePicksRecord(pick); | ||
127 | } | ||
128 | |||
129 | public bool PicksDelete(UUID pickId) | ||
130 | { | ||
131 | return ProfilesData.DeletePicksRecord(pickId); | ||
132 | } | ||
133 | #endregion Picks | ||
134 | |||
135 | #region Notes | ||
136 | public bool AvatarNotesRequest(ref UserProfileNotes note) | ||
137 | { | ||
138 | return ProfilesData.GetAvatarNotes(ref note); | ||
139 | } | ||
140 | |||
141 | public bool NotesUpdate(ref UserProfileNotes note, ref string result) | ||
142 | { | ||
143 | return ProfilesData.UpdateAvatarNotes(ref note, ref result); | ||
144 | } | ||
145 | #endregion Notes | ||
146 | |||
147 | #region Profile Properties | ||
148 | public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result) | ||
149 | { | ||
150 | return ProfilesData.GetAvatarProperties(ref prop, ref result); | ||
151 | } | ||
152 | |||
153 | public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result) | ||
154 | { | ||
155 | return ProfilesData.UpdateAvatarProperties(ref prop, ref result); | ||
156 | } | ||
157 | #endregion Profile Properties | ||
158 | |||
159 | #region Interests | ||
160 | public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result) | ||
161 | { | ||
162 | return ProfilesData.UpdateAvatarInterests(prop, ref result); | ||
163 | } | ||
164 | #endregion Interests | ||
165 | |||
166 | #region Utility | ||
167 | public OSD AvatarImageAssetsRequest(UUID avatarId) | ||
168 | { | ||
169 | OSDArray records = ProfilesData.GetUserImageAssets(avatarId); | ||
170 | return records; | ||
171 | } | ||
172 | #endregion Utility | ||
173 | |||
174 | #region UserData | ||
175 | public bool RequestUserAppData(ref UserAppData prop, ref string result) | ||
176 | { | ||
177 | return ProfilesData.GetUserAppData(ref prop, ref result); | ||
178 | } | ||
179 | |||
180 | public bool SetUserAppData(UserAppData prop, ref string result) | ||
181 | { | ||
182 | return true; | ||
183 | } | ||
184 | #endregion UserData | ||
185 | } | ||
186 | } | ||
187 | |||
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs new file mode 100644 index 0000000..927f7c9 --- /dev/null +++ b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs | |||
@@ -0,0 +1,86 @@ | |||
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.Reflection; | ||
30 | using Nini.Config; | ||
31 | using log4net; | ||
32 | using OpenSim.Services.Base; | ||
33 | using OpenSim.Data; | ||
34 | |||
35 | namespace OpenSim.Services.ProfilesService | ||
36 | { | ||
37 | public class UserProfilesServiceBase: ServiceBase | ||
38 | { | ||
39 | static readonly ILog m_log = | ||
40 | LogManager.GetLogger( | ||
41 | MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
43 | public IProfilesData ProfilesData; | ||
44 | |||
45 | public string ConfigName | ||
46 | { | ||
47 | get; private set; | ||
48 | } | ||
49 | |||
50 | public UserProfilesServiceBase(IConfigSource config, string configName): | ||
51 | base(config) | ||
52 | { | ||
53 | if(string.IsNullOrEmpty(configName)) | ||
54 | { | ||
55 | m_log.WarnFormat("[PROFILES]: Configuration section not given!"); | ||
56 | return; | ||
57 | } | ||
58 | |||
59 | string dllName = String.Empty; | ||
60 | string connString = null; | ||
61 | string realm = String.Empty; | ||
62 | |||
63 | IConfig dbConfig = config.Configs["DatabaseService"]; | ||
64 | if (dbConfig != null) | ||
65 | { | ||
66 | if (dllName == String.Empty) | ||
67 | dllName = dbConfig.GetString("StorageProvider", String.Empty); | ||
68 | if (string.IsNullOrEmpty(connString)) | ||
69 | connString = dbConfig.GetString("ConnectionString", String.Empty); | ||
70 | } | ||
71 | |||
72 | IConfig ProfilesConfig = config.Configs[configName]; | ||
73 | if (ProfilesConfig != null) | ||
74 | { | ||
75 | connString = ProfilesConfig.GetString("ConnectionString", connString); | ||
76 | realm = ProfilesConfig.GetString("Realm", realm); | ||
77 | } | ||
78 | |||
79 | ProfilesData = LoadPlugin<IProfilesData>(dllName, new Object[] { connString }); | ||
80 | if (ProfilesData == null) | ||
81 | throw new Exception("Could not find a storage interface in the given module"); | ||
82 | |||
83 | } | ||
84 | } | ||
85 | } | ||
86 | |||