aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Interfaces/IUserProfilesService.cs48
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesService.cs160
-rw-r--r--OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs59
3 files changed, 267 insertions, 0 deletions
diff --git a/OpenSim/Services/Interfaces/IUserProfilesService.cs b/OpenSim/Services/Interfaces/IUserProfilesService.cs
new file mode 100644
index 0000000..12fc986
--- /dev/null
+++ b/OpenSim/Services/Interfaces/IUserProfilesService.cs
@@ -0,0 +1,48 @@
1using System;
2using OpenSim.Framework;
3using OpenMetaverse;
4using OpenMetaverse.StructuredData;
5
6namespace OpenSim.Services.Interfaces
7{
8 public interface IUserProfilesService
9 {
10 #region Classifieds
11 OSD AvatarClassifiedsRequest(UUID creatorId);
12 bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result);
13 bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result);
14 bool ClassifiedDelete(UUID recordId);
15 #endregion Classifieds
16
17 #region Picks
18 OSD AvatarPicksRequest(UUID creatorId);
19 bool PickInfoRequest(ref UserProfilePick pick, ref string result);
20 bool PicksUpdate(ref UserProfilePick pick, ref string result);
21 bool PicksDelete(UUID pickId);
22 #endregion Picks
23
24 #region Notes
25 bool AvatarNotesRequest(ref UserProfileNotes note);
26 bool NotesUpdate(ref UserProfileNotes note, ref string result);
27 #endregion Notes
28
29 #region Profile Properties
30 bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result);
31 bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result);
32 #endregion Profile Properties
33
34 #region Interests
35 bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result);
36 #endregion Interests
37
38 #region Utility
39 OSD AvatarImageAssetsRequest(UUID avatarId);
40 #endregion Utility
41
42 #region UserData
43 bool RequestUserAppData(ref UserAppData prop, ref string result);
44 bool SetUserAppData(UserAppData prop, ref string result);
45 #endregion UserData
46 }
47}
48
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
new file mode 100644
index 0000000..959c661
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs
@@ -0,0 +1,160 @@
1using System;
2using System.Reflection;
3using System.Text;
4using Nini.Config;
5using log4net;
6using OpenSim.Server.Base;
7using OpenSim.Services.Interfaces;
8using OpenSim.Services.UserAccountService;
9using OpenSim.Data;
10using OpenMetaverse;
11using OpenMetaverse.StructuredData;
12using OpenSim.Framework;
13
14namespace OpenSim.Services.ProfilesService
15{
16 public class UserProfilesService: UserProfilesServiceBase, IUserProfilesService
17 {
18 static readonly ILog m_log =
19 LogManager.GetLogger(
20 MethodBase.GetCurrentMethod().DeclaringType);
21
22 IUserAccountService userAccounts;
23 IAuthenticationService authService;
24
25 public UserProfilesService(IConfigSource config, string configName):
26 base(config, configName)
27 {
28 IConfig Config = config.Configs[configName];
29 if (Config == null)
30 {
31 m_log.Warn("[PROFILES]: No configuration found!");
32 return;
33 }
34 Object[] args = null;
35
36 args = new Object[] { config };
37 string accountService = Config.GetString("UserAccountService", String.Empty);
38 if (accountService != string.Empty)
39 userAccounts = ServerUtils.LoadPlugin<IUserAccountService>(accountService, args);
40
41 args = new Object[] { config };
42 string authServiceConfig = Config.GetString("AuthenticationServiceModule", String.Empty);
43 if (accountService != string.Empty)
44 authService = ServerUtils.LoadPlugin<IAuthenticationService>(authServiceConfig, args);
45 }
46
47 #region Classifieds
48 public OSD AvatarClassifiedsRequest(UUID creatorId)
49 {
50 OSDArray records = ProfilesData.GetClassifiedRecords(creatorId);
51
52 return records;
53 }
54
55 public bool ClassifiedUpdate(UserClassifiedAdd ad, ref string result)
56 {
57 if(!ProfilesData.UpdateClassifiedRecord(ad, ref result))
58 {
59 return false;
60 }
61 result = "success";
62 return true;
63 }
64
65 public bool ClassifiedDelete(UUID recordId)
66 {
67 if(ProfilesData.DeleteClassifiedRecord(recordId))
68 return true;
69
70 return false;
71 }
72
73 public bool ClassifiedInfoRequest(ref UserClassifiedAdd ad, ref string result)
74 {
75 if(ProfilesData.GetClassifiedInfo(ref ad, ref result))
76 return true;
77
78 return false;
79 }
80 #endregion Classifieds
81
82 #region Picks
83 public OSD AvatarPicksRequest(UUID creatorId)
84 {
85 OSDArray records = ProfilesData.GetAvatarPicks(creatorId);
86
87 return records;
88 }
89
90 public bool PickInfoRequest(ref UserProfilePick pick, ref string result)
91 {
92 pick = ProfilesData.GetPickInfo(pick.CreatorId, pick.PickId);
93 result = "OK";
94 return true;
95 }
96
97 public bool PicksUpdate(ref UserProfilePick pick, ref string result)
98 {
99 return ProfilesData.UpdatePicksRecord(pick);
100 }
101
102 public bool PicksDelete(UUID pickId)
103 {
104 return ProfilesData.DeletePicksRecord(pickId);
105 }
106 #endregion Picks
107
108 #region Notes
109 public bool AvatarNotesRequest(ref UserProfileNotes note)
110 {
111 return ProfilesData.GetAvatarNotes(ref note);
112 }
113
114 public bool NotesUpdate(ref UserProfileNotes note, ref string result)
115 {
116 return ProfilesData.UpdateAvatarNotes(ref note, ref result);
117 }
118 #endregion Notes
119
120 #region Profile Properties
121 public bool AvatarPropertiesRequest(ref UserProfileProperties prop, ref string result)
122 {
123 return ProfilesData.GetAvatarProperties(ref prop, ref result);
124 }
125
126 public bool AvatarPropertiesUpdate(ref UserProfileProperties prop, ref string result)
127 {
128 return ProfilesData.UpdateAvatarProperties(ref prop, ref result);
129 }
130 #endregion Profile Properties
131
132 #region Interests
133 public bool AvatarInterestsUpdate(UserProfileProperties prop, ref string result)
134 {
135 return ProfilesData.UpdateAvatarInterests(prop, ref result);
136 }
137 #endregion Interests
138
139 #region Utility
140 public OSD AvatarImageAssetsRequest(UUID avatarId)
141 {
142 OSDArray records = ProfilesData.GetUserImageAssets(avatarId);
143 return records;
144 }
145 #endregion Utility
146
147 #region UserData
148 public bool RequestUserAppData(ref UserAppData prop, ref string result)
149 {
150 return ProfilesData.GetUserAppData(ref prop, ref result);
151 }
152
153 public bool SetUserAppData(UserAppData prop, ref string result)
154 {
155 return true;
156 }
157 #endregion UserData
158 }
159}
160
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
new file mode 100644
index 0000000..dc0be03
--- /dev/null
+++ b/OpenSim/Services/UserProfilesService/UserProfilesServiceBase.cs
@@ -0,0 +1,59 @@
1using System;
2using System.Reflection;
3using Nini.Config;
4using log4net;
5using OpenSim.Services.Base;
6using OpenSim.Data;
7
8namespace OpenSim.Services.ProfilesService
9{
10 public class UserProfilesServiceBase: ServiceBase
11 {
12 static readonly ILog m_log =
13 LogManager.GetLogger(
14 MethodBase.GetCurrentMethod().DeclaringType);
15
16 public IProfilesData ProfilesData;
17
18 public string ConfigName
19 {
20 get; private set;
21 }
22
23 public UserProfilesServiceBase(IConfigSource config, string configName):
24 base(config)
25 {
26 if(string.IsNullOrEmpty(configName))
27 {
28 m_log.WarnFormat("[PROFILES]: Configuration section not given!");
29 return;
30 }
31
32 string dllName = String.Empty;
33 string connString = null;
34 string realm = String.Empty;
35
36 IConfig dbConfig = config.Configs["DatabaseService"];
37 if (dbConfig != null)
38 {
39 if (dllName == String.Empty)
40 dllName = dbConfig.GetString("StorageProvider", String.Empty);
41 if (string.IsNullOrEmpty(connString))
42 connString = dbConfig.GetString("ConnectionString", String.Empty);
43 }
44
45 IConfig ProfilesConfig = config.Configs[configName];
46 if (ProfilesConfig != null)
47 {
48 connString = ProfilesConfig.GetString("ConnectionString", connString);
49 realm = ProfilesConfig.GetString("Realm", realm);
50 }
51
52 ProfilesData = LoadPlugin<IProfilesData>(dllName, new Object[] { connString });
53 if (ProfilesData == null)
54 throw new Exception("Could not find a storage interface in the given module");
55
56 }
57 }
58}
59