diff options
author | Sean Dague | 2008-04-02 15:24:31 +0000 |
---|---|---|
committer | Sean Dague | 2008-04-02 15:24:31 +0000 |
commit | c52c68f314c67c76c7181a6d0828f476290fbd66 (patch) | |
tree | 66ab347502892902a096fa985f31b25738eb1381 /OpenSim/Data/DB4o | |
parent | reorganizing namespaces to put all the Data stuff into it's own namespace (diff) | |
download | opensim-SC_OLD-c52c68f314c67c76c7181a6d0828f476290fbd66.zip opensim-SC_OLD-c52c68f314c67c76c7181a6d0828f476290fbd66.tar.gz opensim-SC_OLD-c52c68f314c67c76c7181a6d0828f476290fbd66.tar.bz2 opensim-SC_OLD-c52c68f314c67c76c7181a6d0828f476290fbd66.tar.xz |
whole lot more moving
Diffstat (limited to 'OpenSim/Data/DB4o')
-rw-r--r-- | OpenSim/Data/DB4o/DB4oGridData.cs | 182 | ||||
-rw-r--r-- | OpenSim/Data/DB4o/DB4oManager.cs | 170 | ||||
-rw-r--r-- | OpenSim/Data/DB4o/DB4oUserData.cs | 270 | ||||
-rw-r--r-- | OpenSim/Data/DB4o/Properties/AssemblyInfo.cs | 65 |
4 files changed, 687 insertions, 0 deletions
diff --git a/OpenSim/Data/DB4o/DB4oGridData.cs b/OpenSim/Data/DB4o/DB4oGridData.cs new file mode 100644 index 0000000..31b13e3 --- /dev/null +++ b/OpenSim/Data/DB4o/DB4oGridData.cs | |||
@@ -0,0 +1,182 @@ | |||
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 OpenSim 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.Collections.Generic; | ||
30 | using libsecondlife; | ||
31 | |||
32 | namespace OpenSim.Framework.Data.DB4o | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// A grid server storage mechanism employing the DB4o database system | ||
36 | /// </summary> | ||
37 | internal class DB4oGridData : GridDataBase | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// The database manager object | ||
41 | /// </summary> | ||
42 | private DB4oGridManager manager; | ||
43 | |||
44 | /// <summary> | ||
45 | /// Called when the plugin is first loaded (as constructors are not called) | ||
46 | /// </summary> | ||
47 | override public void Initialise() | ||
48 | { | ||
49 | manager = new DB4oGridManager("gridserver.yap"); | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// Returns a list of regions within the specified ranges | ||
54 | /// </summary> | ||
55 | /// <param name="a">minimum X coordinate</param> | ||
56 | /// <param name="b">minimum Y coordinate</param> | ||
57 | /// <param name="c">maximum X coordinate</param> | ||
58 | /// <param name="d">maximum Y coordinate</param> | ||
59 | /// <returns>An array of region profiles</returns> | ||
60 | override public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | ||
61 | { | ||
62 | return null; | ||
63 | } | ||
64 | |||
65 | /// <summary> | ||
66 | /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) | ||
67 | /// </summary> | ||
68 | /// <param name="handle">The handle to search for</param> | ||
69 | /// <returns>A region profile</returns> | ||
70 | override public RegionProfileData GetProfileByHandle(ulong handle) | ||
71 | { | ||
72 | lock (manager.simProfiles) | ||
73 | { | ||
74 | foreach (LLUUID UUID in manager.simProfiles.Keys) | ||
75 | { | ||
76 | if (manager.simProfiles[UUID].regionHandle == handle) | ||
77 | { | ||
78 | return manager.simProfiles[UUID]; | ||
79 | } | ||
80 | } | ||
81 | } | ||
82 | throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); | ||
83 | } | ||
84 | |||
85 | /// <summary> | ||
86 | /// Returns a specific region | ||
87 | /// </summary> | ||
88 | /// <param name="uuid">The region ID code</param> | ||
89 | /// <returns>A region profile</returns> | ||
90 | override public RegionProfileData GetProfileByLLUUID(LLUUID uuid) | ||
91 | { | ||
92 | lock (manager.simProfiles) | ||
93 | { | ||
94 | if (manager.simProfiles.ContainsKey(uuid)) | ||
95 | return manager.simProfiles[uuid]; | ||
96 | } | ||
97 | throw new Exception("Unable to find profile with UUID (" + uuid.ToString() + | ||
98 | "). Total Registered Regions: " + manager.simProfiles.Count); | ||
99 | } | ||
100 | |||
101 | override public RegionProfileData GetProfileByString(string regionName) | ||
102 | { | ||
103 | throw new Exception("GetProfileByString Not supported in DB4oGridData"); | ||
104 | //return null; | ||
105 | } | ||
106 | |||
107 | /// <summary> | ||
108 | /// Adds a new specified region to the database | ||
109 | /// </summary> | ||
110 | /// <param name="profile">The profile to add</param> | ||
111 | /// <returns>A dataresponse enum indicating success</returns> | ||
112 | override public DataResponse AddProfile(RegionProfileData profile) | ||
113 | { | ||
114 | lock (manager.simProfiles) | ||
115 | { | ||
116 | if (manager.AddRow(profile)) | ||
117 | { | ||
118 | return DataResponse.RESPONSE_OK; | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | return DataResponse.RESPONSE_ERROR; | ||
123 | } | ||
124 | } | ||
125 | } | ||
126 | |||
127 | /// <summary> | ||
128 | /// Authenticates a new region using the shared secrets. NOT SECURE. | ||
129 | /// </summary> | ||
130 | /// <param name="uuid">The UUID the region is authenticating with</param> | ||
131 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> | ||
132 | /// <param name="key">The shared secret</param> | ||
133 | /// <returns>Authenticated?</returns> | ||
134 | override public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) | ||
135 | { | ||
136 | if (manager.simProfiles[uuid].regionRecvKey == key) | ||
137 | return true; | ||
138 | return false; | ||
139 | } | ||
140 | |||
141 | /// <summary> | ||
142 | /// Shuts down the database | ||
143 | /// </summary> | ||
144 | override public void Close() | ||
145 | { | ||
146 | manager = null; | ||
147 | } | ||
148 | |||
149 | /// <summary> | ||
150 | /// // Returns a list of avatar and UUIDs that match the query | ||
151 | /// </summary> | ||
152 | public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | ||
153 | { | ||
154 | //Do nothing yet | ||
155 | List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>(); | ||
156 | return returnlist; | ||
157 | } | ||
158 | |||
159 | /// <summary> | ||
160 | /// Returns the providers name | ||
161 | /// </summary> | ||
162 | /// <returns>The name of the storage system</returns> | ||
163 | override public string getName() | ||
164 | { | ||
165 | return "DB4o Grid Provider"; | ||
166 | } | ||
167 | |||
168 | /// <summary> | ||
169 | /// Returns the providers version | ||
170 | /// </summary> | ||
171 | /// <returns>The version of the storage system</returns> | ||
172 | override public string getVersion() | ||
173 | { | ||
174 | return "0.1"; | ||
175 | } | ||
176 | |||
177 | override public ReservationData GetReservationAtPoint(uint x, uint y) | ||
178 | { | ||
179 | return null; | ||
180 | } | ||
181 | } | ||
182 | } | ||
diff --git a/OpenSim/Data/DB4o/DB4oManager.cs b/OpenSim/Data/DB4o/DB4oManager.cs new file mode 100644 index 0000000..9cacb5e --- /dev/null +++ b/OpenSim/Data/DB4o/DB4oManager.cs | |||
@@ -0,0 +1,170 @@ | |||
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 OpenSim 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.Collections.Generic; | ||
30 | using Db4objects.Db4o; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.Framework.Data.DB4o | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A Database manager for Db4o | ||
37 | /// </summary> | ||
38 | internal class DB4oGridManager | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A list of the current regions connected (in-memory cache) | ||
42 | /// </summary> | ||
43 | public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>(); | ||
44 | |||
45 | /// <summary> | ||
46 | /// Database File Name | ||
47 | /// </summary> | ||
48 | private string dbfl; | ||
49 | |||
50 | /// <summary> | ||
51 | /// Creates a new grid storage manager | ||
52 | /// </summary> | ||
53 | /// <param name="db4odb">Filename to the database file</param> | ||
54 | public DB4oGridManager(string db4odb) | ||
55 | { | ||
56 | dbfl = db4odb; | ||
57 | IObjectContainer database; | ||
58 | database = Db4oFactory.OpenFile(dbfl); | ||
59 | IObjectSet result = database.Get(typeof (RegionProfileData)); | ||
60 | // Loads the file into the in-memory cache | ||
61 | foreach (RegionProfileData row in result) | ||
62 | { | ||
63 | simProfiles.Add(row.UUID, row); | ||
64 | } | ||
65 | database.Close(); | ||
66 | } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Adds a new profile to the database (Warning: Probably slow.) | ||
70 | /// </summary> | ||
71 | /// <param name="row">The profile to add</param> | ||
72 | /// <returns>Successful?</returns> | ||
73 | public bool AddRow(RegionProfileData row) | ||
74 | { | ||
75 | if (simProfiles.ContainsKey(row.UUID)) | ||
76 | { | ||
77 | simProfiles[row.UUID] = row; | ||
78 | } | ||
79 | else | ||
80 | { | ||
81 | simProfiles.Add(row.UUID, row); | ||
82 | } | ||
83 | |||
84 | try | ||
85 | { | ||
86 | IObjectContainer database; | ||
87 | database = Db4oFactory.OpenFile(dbfl); | ||
88 | database.Set(row); | ||
89 | database.Close(); | ||
90 | return true; | ||
91 | } | ||
92 | catch (Exception) | ||
93 | { | ||
94 | return false; | ||
95 | } | ||
96 | } | ||
97 | } | ||
98 | |||
99 | /// <summary> | ||
100 | /// A manager for the DB4o database (user profiles) | ||
101 | /// </summary> | ||
102 | internal class DB4oUserManager | ||
103 | { | ||
104 | /// <summary> | ||
105 | /// A list of the user profiles (in memory cache) | ||
106 | /// </summary> | ||
107 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); | ||
108 | |||
109 | /// <summary> | ||
110 | /// Database filename | ||
111 | /// </summary> | ||
112 | private string dbfl; | ||
113 | |||
114 | /// <summary> | ||
115 | /// Initialises a new DB manager | ||
116 | /// </summary> | ||
117 | /// <param name="db4odb">The filename to the database</param> | ||
118 | public DB4oUserManager(string db4odb) | ||
119 | { | ||
120 | dbfl = db4odb; | ||
121 | IObjectContainer database; | ||
122 | database = Db4oFactory.OpenFile(dbfl); | ||
123 | // Load to cache | ||
124 | IObjectSet result = database.Get(typeof (UserProfileData)); | ||
125 | foreach (UserProfileData row in result) | ||
126 | { | ||
127 | if (userProfiles.ContainsKey(row.UUID)) | ||
128 | userProfiles[row.UUID] = row; | ||
129 | else | ||
130 | userProfiles.Add(row.UUID, row); | ||
131 | } | ||
132 | database.Close(); | ||
133 | } | ||
134 | |||
135 | /// <summary> | ||
136 | /// Adds or updates a record to the user database. Do this when changes are needed | ||
137 | /// in the user profile that need to be persistant. | ||
138 | /// | ||
139 | /// TODO: the logic here is not ACID, the local cache will be | ||
140 | /// updated even if the persistant data is not. This may lead | ||
141 | /// to unexpected results. | ||
142 | /// </summary> | ||
143 | /// <param name="record">The profile to update</param> | ||
144 | /// <returns>true on success, false on fail to persist to db</returns> | ||
145 | public bool UpdateRecord(UserProfileData record) | ||
146 | { | ||
147 | if (userProfiles.ContainsKey(record.UUID)) | ||
148 | { | ||
149 | userProfiles[record.UUID] = record; | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | userProfiles.Add(record.UUID, record); | ||
154 | } | ||
155 | |||
156 | try | ||
157 | { | ||
158 | IObjectContainer database; | ||
159 | database = Db4oFactory.OpenFile(dbfl); | ||
160 | database.Set(record); | ||
161 | database.Close(); | ||
162 | return true; | ||
163 | } | ||
164 | catch (Exception) | ||
165 | { | ||
166 | return false; | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | } | ||
diff --git a/OpenSim/Data/DB4o/DB4oUserData.cs b/OpenSim/Data/DB4o/DB4oUserData.cs new file mode 100644 index 0000000..3072e81 --- /dev/null +++ b/OpenSim/Data/DB4o/DB4oUserData.cs | |||
@@ -0,0 +1,270 @@ | |||
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 OpenSim 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.Collections.Generic; | ||
30 | using System.IO; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenSim.Framework.Data.DB4o | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A User storage interface for the DB4o database system | ||
37 | /// </summary> | ||
38 | public class DB4oUserData : IUserData | ||
39 | { | ||
40 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
41 | |||
42 | /// <summary> | ||
43 | /// The database manager | ||
44 | /// </summary> | ||
45 | private DB4oUserManager manager; | ||
46 | |||
47 | /// <summary> | ||
48 | /// Artificial constructor called upon plugin load | ||
49 | /// </summary> | ||
50 | public void Initialise() | ||
51 | { | ||
52 | manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap")); | ||
53 | } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Loads a specified user profile from a UUID | ||
57 | /// </summary> | ||
58 | /// <param name="uuid">The users UUID</param> | ||
59 | /// <returns>A user profile</returns> | ||
60 | public UserProfileData GetUserByUUID(LLUUID uuid) | ||
61 | { | ||
62 | if (manager.userProfiles.ContainsKey(uuid)) | ||
63 | return manager.userProfiles[uuid]; | ||
64 | return null; | ||
65 | } | ||
66 | |||
67 | /// <summary> | ||
68 | /// Returns a user by searching for its name | ||
69 | /// </summary> | ||
70 | /// <param name="name">The users account name</param> | ||
71 | /// <returns>A matching users profile</returns> | ||
72 | public UserProfileData GetUserByName(string name) | ||
73 | { | ||
74 | return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
75 | } | ||
76 | |||
77 | /// <summary> | ||
78 | /// Returns a user by searching for its name | ||
79 | /// </summary> | ||
80 | /// <param name="fname">The first part of the users account name</param> | ||
81 | /// <param name="lname">The second part of the users account name</param> | ||
82 | /// <returns>A matching users profile</returns> | ||
83 | public UserProfileData GetUserByName(string fname, string lname) | ||
84 | { | ||
85 | foreach (UserProfileData profile in manager.userProfiles.Values) | ||
86 | { | ||
87 | if (profile.username == fname && profile.surname == lname) | ||
88 | return profile; | ||
89 | } | ||
90 | return null; | ||
91 | } | ||
92 | |||
93 | /// <summary> | ||
94 | /// Returns a user by UUID direct | ||
95 | /// </summary> | ||
96 | /// <param name="uuid">The users account ID</param> | ||
97 | /// <returns>A matching users profile</returns> | ||
98 | public UserAgentData GetAgentByUUID(LLUUID uuid) | ||
99 | { | ||
100 | try | ||
101 | { | ||
102 | return GetUserByUUID(uuid).currentAgent; | ||
103 | } | ||
104 | catch (Exception) | ||
105 | { | ||
106 | return null; | ||
107 | } | ||
108 | } | ||
109 | |||
110 | /// <summary> | ||
111 | /// Returns a session by account name | ||
112 | /// </summary> | ||
113 | /// <param name="name">The account name</param> | ||
114 | /// <returns>The users session agent</returns> | ||
115 | public UserAgentData GetAgentByName(string name) | ||
116 | { | ||
117 | return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
118 | } | ||
119 | |||
120 | /// <summary> | ||
121 | /// Returns a session by account name | ||
122 | /// </summary> | ||
123 | /// <param name="fname">The first part of the users account name</param> | ||
124 | /// <param name="lname">The second part of the users account name</param> | ||
125 | /// <returns>A user agent</returns> | ||
126 | public UserAgentData GetAgentByName(string fname, string lname) | ||
127 | { | ||
128 | try | ||
129 | { | ||
130 | return GetUserByName(fname, lname).currentAgent; | ||
131 | } | ||
132 | catch (Exception) | ||
133 | { | ||
134 | return null; | ||
135 | } | ||
136 | } | ||
137 | public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey) | ||
138 | { | ||
139 | UserProfileData user = GetUserByUUID(AgentID); | ||
140 | user.webLoginKey = WebLoginKey; | ||
141 | UpdateUserProfile(user); | ||
142 | |||
143 | } | ||
144 | #region User Friends List Data | ||
145 | |||
146 | public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) | ||
147 | { | ||
148 | //m_log.Info("[FRIEND]: Stub AddNewUserFriend called"); | ||
149 | } | ||
150 | |||
151 | public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend) | ||
152 | { | ||
153 | //m_log.Info("[FRIEND]: Stub RemoveUserFriend called"); | ||
154 | } | ||
155 | public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms) | ||
156 | { | ||
157 | //m_log.Info("[FRIEND]: Stub UpdateUserFriendPerms called"); | ||
158 | } | ||
159 | |||
160 | |||
161 | public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner) | ||
162 | { | ||
163 | //m_log.Info("[FRIEND]: Stub GetUserFriendList called"); | ||
164 | return new List<FriendListItem>(); | ||
165 | } | ||
166 | |||
167 | #endregion | ||
168 | |||
169 | public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) | ||
170 | { | ||
171 | //m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called"); | ||
172 | } | ||
173 | |||
174 | |||
175 | |||
176 | public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query) | ||
177 | { | ||
178 | //Do nothing yet | ||
179 | List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>(); | ||
180 | return returnlist; | ||
181 | } | ||
182 | |||
183 | /// <summary> | ||
184 | /// Creates a new user profile | ||
185 | /// </summary> | ||
186 | /// <param name="user">The profile to add to the database</param> | ||
187 | public void AddNewUserProfile(UserProfileData user) | ||
188 | { | ||
189 | try | ||
190 | { | ||
191 | manager.UpdateRecord(user); | ||
192 | } | ||
193 | catch (Exception e) | ||
194 | { | ||
195 | Console.WriteLine(e.ToString()); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | /// <summary> | ||
200 | /// Creates a new user profile | ||
201 | /// </summary> | ||
202 | /// <param name="user">The profile to add to the database</param> | ||
203 | /// <returns>True on success, false on error</returns> | ||
204 | public bool UpdateUserProfile(UserProfileData user) | ||
205 | { | ||
206 | try | ||
207 | { | ||
208 | return manager.UpdateRecord(user); | ||
209 | } | ||
210 | catch (Exception e) | ||
211 | { | ||
212 | Console.WriteLine(e.ToString()); | ||
213 | return false; | ||
214 | } | ||
215 | } | ||
216 | |||
217 | |||
218 | /// <summary> | ||
219 | /// Creates a new user agent | ||
220 | /// </summary> | ||
221 | /// <param name="agent">The agent to add to the database</param> | ||
222 | public void AddNewUserAgent(UserAgentData agent) | ||
223 | { | ||
224 | // Do nothing. yet. | ||
225 | } | ||
226 | |||
227 | /// <summary> | ||
228 | /// Transfers money between two user accounts | ||
229 | /// </summary> | ||
230 | /// <param name="from">Starting account</param> | ||
231 | /// <param name="to">End account</param> | ||
232 | /// <param name="amount">The amount to move</param> | ||
233 | /// <returns>Success?</returns> | ||
234 | public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount) | ||
235 | { | ||
236 | return true; | ||
237 | } | ||
238 | |||
239 | /// <summary> | ||
240 | /// Transfers inventory between two accounts | ||
241 | /// </summary> | ||
242 | /// <remarks>Move to inventory server</remarks> | ||
243 | /// <param name="from">Senders account</param> | ||
244 | /// <param name="to">Receivers account</param> | ||
245 | /// <param name="item">Inventory item</param> | ||
246 | /// <returns>Success?</returns> | ||
247 | public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | ||
248 | { | ||
249 | return true; | ||
250 | } | ||
251 | |||
252 | /// <summary> | ||
253 | /// Returns the name of the storage provider | ||
254 | /// </summary> | ||
255 | /// <returns>Storage provider name</returns> | ||
256 | public string getName() | ||
257 | { | ||
258 | return "DB4o Userdata"; | ||
259 | } | ||
260 | |||
261 | /// <summary> | ||
262 | /// Returns the version of the storage provider | ||
263 | /// </summary> | ||
264 | /// <returns>Storage provider version</returns> | ||
265 | public string GetVersion() | ||
266 | { | ||
267 | return "0.1"; | ||
268 | } | ||
269 | } | ||
270 | } | ||
diff --git a/OpenSim/Data/DB4o/Properties/AssemblyInfo.cs b/OpenSim/Data/DB4o/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..ee84938 --- /dev/null +++ b/OpenSim/Data/DB4o/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,65 @@ | |||
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 OpenSim 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.Reflection; | ||
29 | using System.Runtime.InteropServices; | ||
30 | |||
31 | // General Information about an assembly is controlled through the following | ||
32 | // set of attributes. Change these attribute values to modify the information | ||
33 | // associated with an assembly. | ||
34 | |||
35 | [assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")] | ||
36 | [assembly : AssemblyDescription("")] | ||
37 | [assembly : AssemblyConfiguration("")] | ||
38 | [assembly : AssemblyCompany("")] | ||
39 | [assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")] | ||
40 | [assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2008")] | ||
41 | [assembly : AssemblyTrademark("")] | ||
42 | [assembly : AssemblyCulture("")] | ||
43 | |||
44 | // Setting ComVisible to false makes the types in this assembly not visible | ||
45 | // to COM components. If you need to access a type in this assembly from | ||
46 | // COM, set the ComVisible attribute to true on that type. | ||
47 | |||
48 | [assembly : ComVisible(false)] | ||
49 | |||
50 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
51 | |||
52 | [assembly : Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] | ||
53 | |||
54 | // Version information for an assembly consists of the following four values: | ||
55 | // | ||
56 | // Major Version | ||
57 | // Minor Version | ||
58 | // Build Number | ||
59 | // Revision | ||
60 | // | ||
61 | // You can specify all the values or you can default the Revision and Build Numbers | ||
62 | // by using the '*' as shown below: | ||
63 | |||
64 | [assembly : AssemblyVersion("1.0.0.0")] | ||
65 | [assembly : AssemblyFileVersion("1.0.0.0")] | ||