aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.DB4o/DB4oUserData.cs')
-rw-r--r--OpenSim/Framework/Data.DB4o/DB4oUserData.cs404
1 files changed, 202 insertions, 202 deletions
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
index 2e33ab0..845b764 100644
--- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
+++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs
@@ -1,202 +1,202 @@
1/* 1/*
2* Copyright (c) Contributors, http://www.openmetaverse.org/ 2* Copyright (c) Contributors, http://www.openmetaverse.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
5* Redistribution and use in source and binary forms, with or without 5* Redistribution and use in source and binary forms, with or without
6* modification, are permitted provided that the following conditions are met: 6* modification, are permitted provided that the following conditions are met:
7* * Redistributions of source code must retain the above copyright 7* * Redistributions of source code must retain the above copyright
8* notice, this list of conditions and the following disclaimer. 8* notice, this list of conditions and the following disclaimer.
9* * Redistributions in binary form must reproduce the above copyright 9* * Redistributions in binary form must reproduce the above copyright
10* notice, this list of conditions and the following disclaimer in the 10* notice, this list of conditions and the following disclaimer in the
11* documentation and/or other materials provided with the distribution. 11* documentation and/or other materials provided with the distribution.
12* * Neither the name of the OpenSim Project nor the 12* * Neither the name of the OpenSim Project nor the
13* names of its contributors may be used to endorse or promote products 13* names of its contributors may be used to endorse or promote products
14* derived from this software without specific prior written permission. 14* derived from this software without specific prior written permission.
15* 15*
16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY 16* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY 19* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 25* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26* 26*
27*/ 27*/
28using System; 28using System;
29using libsecondlife; 29using libsecondlife;
30 30
31namespace OpenSim.Framework.Data.DB4o 31namespace OpenSim.Framework.Data.DB4o
32{ 32{
33 /// <summary> 33 /// <summary>
34 /// A User storage interface for the DB4o database system 34 /// A User storage interface for the DB4o database system
35 /// </summary> 35 /// </summary>
36 public class DB4oUserData : IUserData 36 public class DB4oUserData : IUserData
37 { 37 {
38 /// <summary> 38 /// <summary>
39 /// The database manager 39 /// The database manager
40 /// </summary> 40 /// </summary>
41 DB4oUserManager manager; 41 DB4oUserManager manager;
42 42
43 /// <summary> 43 /// <summary>
44 /// Artificial constructor called upon plugin load 44 /// Artificial constructor called upon plugin load
45 /// </summary> 45 /// </summary>
46 public void Initialise() 46 public void Initialise()
47 { 47 {
48 manager = new DB4oUserManager("userprofiles.yap"); 48 manager = new DB4oUserManager("userprofiles.yap");
49 } 49 }
50 50
51 /// <summary> 51 /// <summary>
52 /// Loads a specified user profile from a UUID 52 /// Loads a specified user profile from a UUID
53 /// </summary> 53 /// </summary>
54 /// <param name="uuid">The users UUID</param> 54 /// <param name="uuid">The users UUID</param>
55 /// <returns>A user profile</returns> 55 /// <returns>A user profile</returns>
56 public UserProfileData getUserByUUID(LLUUID uuid) 56 public UserProfileData getUserByUUID(LLUUID uuid)
57 { 57 {
58 if(manager.userProfiles.ContainsKey(uuid)) 58 if(manager.userProfiles.ContainsKey(uuid))
59 return manager.userProfiles[uuid]; 59 return manager.userProfiles[uuid];
60 return null; 60 return null;
61 } 61 }
62 62
63 /// <summary> 63 /// <summary>
64 /// Returns a user by searching for its name 64 /// Returns a user by searching for its name
65 /// </summary> 65 /// </summary>
66 /// <param name="name">The users account name</param> 66 /// <param name="name">The users account name</param>
67 /// <returns>A matching users profile</returns> 67 /// <returns>A matching users profile</returns>
68 public UserProfileData getUserByName(string name) 68 public UserProfileData getUserByName(string name)
69 { 69 {
70 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); 70 return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
71 } 71 }
72 72
73 /// <summary> 73 /// <summary>
74 /// Returns a user by searching for its name 74 /// Returns a user by searching for its name
75 /// </summary> 75 /// </summary>
76 /// <param name="fname">The first part of the users account name</param> 76 /// <param name="fname">The first part of the users account name</param>
77 /// <param name="lname">The second part of the users account name</param> 77 /// <param name="lname">The second part of the users account name</param>
78 /// <returns>A matching users profile</returns> 78 /// <returns>A matching users profile</returns>
79 public UserProfileData getUserByName(string fname, string lname) 79 public UserProfileData getUserByName(string fname, string lname)
80 { 80 {
81 foreach (UserProfileData profile in manager.userProfiles.Values) 81 foreach (UserProfileData profile in manager.userProfiles.Values)
82 { 82 {
83 if (profile.username == fname && profile.surname == lname) 83 if (profile.username == fname && profile.surname == lname)
84 return profile; 84 return profile;
85 } 85 }
86 return null; 86 return null;
87 } 87 }
88 88
89 /// <summary> 89 /// <summary>
90 /// Returns a user by UUID direct 90 /// Returns a user by UUID direct
91 /// </summary> 91 /// </summary>
92 /// <param name="uuid">The users account ID</param> 92 /// <param name="uuid">The users account ID</param>
93 /// <returns>A matching users profile</returns> 93 /// <returns>A matching users profile</returns>
94 public UserAgentData getAgentByUUID(LLUUID uuid) 94 public UserAgentData getAgentByUUID(LLUUID uuid)
95 { 95 {
96 try 96 try
97 { 97 {
98 return getUserByUUID(uuid).currentAgent; 98 return getUserByUUID(uuid).currentAgent;
99 } 99 }
100 catch (Exception) 100 catch (Exception)
101 { 101 {
102 return null; 102 return null;
103 } 103 }
104 } 104 }
105 105
106 /// <summary> 106 /// <summary>
107 /// Returns a session by account name 107 /// Returns a session by account name
108 /// </summary> 108 /// </summary>
109 /// <param name="name">The account name</param> 109 /// <param name="name">The account name</param>
110 /// <returns>The users session agent</returns> 110 /// <returns>The users session agent</returns>
111 public UserAgentData getAgentByName(string name) 111 public UserAgentData getAgentByName(string name)
112 { 112 {
113 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); 113 return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
114 } 114 }
115 115
116 /// <summary> 116 /// <summary>
117 /// Returns a session by account name 117 /// Returns a session by account name
118 /// </summary> 118 /// </summary>
119 /// <param name="fname">The first part of the users account name</param> 119 /// <param name="fname">The first part of the users account name</param>
120 /// <param name="lname">The second part of the users account name</param> 120 /// <param name="lname">The second part of the users account name</param>
121 /// <returns>A user agent</returns> 121 /// <returns>A user agent</returns>
122 public UserAgentData getAgentByName(string fname, string lname) 122 public UserAgentData getAgentByName(string fname, string lname)
123 { 123 {
124 try 124 try
125 { 125 {
126 return getUserByName(fname,lname).currentAgent; 126 return getUserByName(fname,lname).currentAgent;
127 } 127 }
128 catch (Exception) 128 catch (Exception)
129 { 129 {
130 return null; 130 return null;
131 } 131 }
132 } 132 }
133 133
134 /// <summary> 134 /// <summary>
135 /// Creates a new user profile 135 /// Creates a new user profile
136 /// </summary> 136 /// </summary>
137 /// <param name="user">The profile to add to the database</param> 137 /// <param name="user">The profile to add to the database</param>
138 public void addNewUserProfile(UserProfileData user) 138 public void addNewUserProfile(UserProfileData user)
139 { 139 {
140 try 140 try
141 { 141 {
142 manager.AddRow(user); 142 manager.AddRow(user);
143 } 143 }
144 catch (Exception e) 144 catch (Exception e)
145 { 145 {
146 Console.WriteLine(e.ToString()); 146 Console.WriteLine(e.ToString());
147 } 147 }
148 } 148 }
149 149
150 /// <summary> 150 /// <summary>
151 /// Creates a new user agent 151 /// Creates a new user agent
152 /// </summary> 152 /// </summary>
153 /// <param name="agent">The agent to add to the database</param> 153 /// <param name="agent">The agent to add to the database</param>
154 public void addNewUserAgent(UserAgentData agent) 154 public void addNewUserAgent(UserAgentData agent)
155 { 155 {
156 // Do nothing. yet. 156 // Do nothing. yet.
157 } 157 }
158 158
159 /// <summary> 159 /// <summary>
160 /// Transfers money between two user accounts 160 /// Transfers money between two user accounts
161 /// </summary> 161 /// </summary>
162 /// <param name="from">Starting account</param> 162 /// <param name="from">Starting account</param>
163 /// <param name="to">End account</param> 163 /// <param name="to">End account</param>
164 /// <param name="amount">The amount to move</param> 164 /// <param name="amount">The amount to move</param>
165 /// <returns>Success?</returns> 165 /// <returns>Success?</returns>
166 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) 166 public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
167 { 167 {
168 return true; 168 return true;
169 } 169 }
170 170
171 /// <summary> 171 /// <summary>
172 /// Transfers inventory between two accounts 172 /// Transfers inventory between two accounts
173 /// </summary> 173 /// </summary>
174 /// <remarks>Move to inventory server</remarks> 174 /// <remarks>Move to inventory server</remarks>
175 /// <param name="from">Senders account</param> 175 /// <param name="from">Senders account</param>
176 /// <param name="to">Recievers account</param> 176 /// <param name="to">Recievers account</param>
177 /// <param name="item">Inventory item</param> 177 /// <param name="item">Inventory item</param>
178 /// <returns>Success?</returns> 178 /// <returns>Success?</returns>
179 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) 179 public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
180 { 180 {
181 return true; 181 return true;
182 } 182 }
183 183
184 /// <summary> 184 /// <summary>
185 /// Returns the name of the storage provider 185 /// Returns the name of the storage provider
186 /// </summary> 186 /// </summary>
187 /// <returns>Storage provider name</returns> 187 /// <returns>Storage provider name</returns>
188 public string getName() 188 public string getName()
189 { 189 {
190 return "DB4o Userdata"; 190 return "DB4o Userdata";
191 } 191 }
192 192
193 /// <summary> 193 /// <summary>
194 /// Returns the version of the storage provider 194 /// Returns the version of the storage provider
195 /// </summary> 195 /// </summary>
196 /// <returns>Storage provider version</returns> 196 /// <returns>Storage provider version</returns>
197 public string getVersion() 197 public string getVersion()
198 { 198 {
199 return "0.1"; 199 return "0.1";
200 } 200 }
201 } 201 }
202} 202}