diff options
author | Adam Frisby | 2007-07-11 08:02:47 +0000 |
---|---|---|
committer | Adam Frisby | 2007-07-11 08:02:47 +0000 |
commit | 5c7ffdde0b9642a42e8f5987e06eb01220ff7776 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /OpenGridServices/OpenGrid.Framework.Data | |
parent | Who would have known that the only way of specifying utf-8 without preamble, ... (diff) | |
download | opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.zip opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.gz opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.bz2 opensim-SC-5c7ffdde0b9642a42e8f5987e06eb01220ff7776.tar.xz |
* Wiping trunk in prep for Sugilite
Diffstat (limited to '')
34 files changed, 0 insertions, 4826 deletions
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs deleted file mode 100644 index 2b23131..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oGridData.cs +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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 | |||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Text; | ||
32 | using OpenGrid.Framework.Data; | ||
33 | using libsecondlife; | ||
34 | |||
35 | |||
36 | namespace OpenGrid.Framework.Data.DB4o | ||
37 | { | ||
38 | /// <summary> | ||
39 | /// A grid server storage mechanism employing the DB4o database system | ||
40 | /// </summary> | ||
41 | class DB4oGridData : IGridData | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// The database manager object | ||
45 | /// </summary> | ||
46 | DB4oGridManager manager; | ||
47 | |||
48 | /// <summary> | ||
49 | /// Called when the plugin is first loaded (as constructors are not called) | ||
50 | /// </summary> | ||
51 | public void Initialise() { | ||
52 | manager = new DB4oGridManager("gridserver.yap"); | ||
53 | } | ||
54 | |||
55 | /// <summary> | ||
56 | /// Returns a list of regions within the specified ranges | ||
57 | /// </summary> | ||
58 | /// <param name="a">minimum X coordinate</param> | ||
59 | /// <param name="b">minimum Y coordinate</param> | ||
60 | /// <param name="c">maximum X coordinate</param> | ||
61 | /// <param name="d">maximum Y coordinate</param> | ||
62 | /// <returns>An array of region profiles</returns> | ||
63 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | ||
64 | { | ||
65 | return null; | ||
66 | } | ||
67 | |||
68 | /// <summary> | ||
69 | /// Returns a region located at the specified regionHandle (warning multiple regions may occupy the one spot, first found is returned) | ||
70 | /// </summary> | ||
71 | /// <param name="handle">The handle to search for</param> | ||
72 | /// <returns>A region profile</returns> | ||
73 | public SimProfileData GetProfileByHandle(ulong handle) { | ||
74 | lock (manager.simProfiles) | ||
75 | { | ||
76 | foreach (LLUUID UUID in manager.simProfiles.Keys) | ||
77 | { | ||
78 | if (manager.simProfiles[UUID].regionHandle == handle) | ||
79 | { | ||
80 | return manager.simProfiles[UUID]; | ||
81 | } | ||
82 | } | ||
83 | } | ||
84 | throw new Exception("Unable to find profile with handle (" + handle.ToString() + ")"); | ||
85 | } | ||
86 | |||
87 | /// <summary> | ||
88 | /// Returns a specific region | ||
89 | /// </summary> | ||
90 | /// <param name="uuid">The region ID code</param> | ||
91 | /// <returns>A region profile</returns> | ||
92 | public SimProfileData GetProfileByLLUUID(LLUUID uuid) | ||
93 | { | ||
94 | lock (manager.simProfiles) | ||
95 | { | ||
96 | if (manager.simProfiles.ContainsKey(uuid)) | ||
97 | return manager.simProfiles[uuid]; | ||
98 | } | ||
99 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + ")"); | ||
100 | } | ||
101 | |||
102 | /// <summary> | ||
103 | /// Adds a new specified region to the database | ||
104 | /// </summary> | ||
105 | /// <param name="profile">The profile to add</param> | ||
106 | /// <returns>A dataresponse enum indicating success</returns> | ||
107 | public DataResponse AddProfile(SimProfileData profile) | ||
108 | { | ||
109 | lock (manager.simProfiles) | ||
110 | { | ||
111 | if (manager.AddRow(profile)) | ||
112 | { | ||
113 | return DataResponse.RESPONSE_OK; | ||
114 | } | ||
115 | else | ||
116 | { | ||
117 | return DataResponse.RESPONSE_ERROR; | ||
118 | } | ||
119 | } | ||
120 | } | ||
121 | |||
122 | /// <summary> | ||
123 | /// Authenticates a new region using the shared secrets. NOT SECURE. | ||
124 | /// </summary> | ||
125 | /// <param name="uuid">The UUID the region is authenticating with</param> | ||
126 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> | ||
127 | /// <param name="key">The shared secret</param> | ||
128 | /// <returns>Authenticated?</returns> | ||
129 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { | ||
130 | if (manager.simProfiles[uuid].regionRecvKey == key) | ||
131 | return true; | ||
132 | return false; | ||
133 | } | ||
134 | |||
135 | /// <summary> | ||
136 | /// Shuts down the database | ||
137 | /// </summary> | ||
138 | public void Close() | ||
139 | { | ||
140 | manager = null; | ||
141 | } | ||
142 | |||
143 | /// <summary> | ||
144 | /// Returns the providers name | ||
145 | /// </summary> | ||
146 | /// <returns>The name of the storage system</returns> | ||
147 | public string getName() | ||
148 | { | ||
149 | return "DB4o Grid Provider"; | ||
150 | } | ||
151 | |||
152 | /// <summary> | ||
153 | /// Returns the providers version | ||
154 | /// </summary> | ||
155 | /// <returns>The version of the storage system</returns> | ||
156 | public string getVersion() | ||
157 | { | ||
158 | return "0.1"; | ||
159 | } | ||
160 | } | ||
161 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs deleted file mode 100644 index 356a49c..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oManager.cs +++ /dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using Db4objects.Db4o; | ||
32 | using OpenGrid.Framework.Data; | ||
33 | using libsecondlife; | ||
34 | |||
35 | namespace OpenGrid.Framework.Data.DB4o | ||
36 | { | ||
37 | /// <summary> | ||
38 | /// A Database manager for Db4o | ||
39 | /// </summary> | ||
40 | class DB4oGridManager | ||
41 | { | ||
42 | /// <summary> | ||
43 | /// A list of the current regions connected (in-memory cache) | ||
44 | /// </summary> | ||
45 | public Dictionary<LLUUID, SimProfileData> simProfiles = new Dictionary<LLUUID, SimProfileData>(); | ||
46 | /// <summary> | ||
47 | /// Database File Name | ||
48 | /// </summary> | ||
49 | string dbfl; | ||
50 | |||
51 | /// <summary> | ||
52 | /// Creates a new grid storage manager | ||
53 | /// </summary> | ||
54 | /// <param name="db4odb">Filename to the database file</param> | ||
55 | public DB4oGridManager(string db4odb) | ||
56 | { | ||
57 | dbfl = db4odb; | ||
58 | IObjectContainer database; | ||
59 | database = Db4oFactory.OpenFile(dbfl); | ||
60 | IObjectSet result = database.Get(typeof(SimProfileData)); | ||
61 | // Loads the file into the in-memory cache | ||
62 | foreach(SimProfileData row in result) { | ||
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(SimProfileData 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 e) | ||
93 | { | ||
94 | return false; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | |||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// A manager for the DB4o database (user profiles) | ||
103 | /// </summary> | ||
104 | class DB4oUserManager | ||
105 | { | ||
106 | /// <summary> | ||
107 | /// A list of the user profiles (in memory cache) | ||
108 | /// </summary> | ||
109 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); | ||
110 | /// <summary> | ||
111 | /// Database filename | ||
112 | /// </summary> | ||
113 | string dbfl; | ||
114 | |||
115 | /// <summary> | ||
116 | /// Initialises a new DB manager | ||
117 | /// </summary> | ||
118 | /// <param name="db4odb">The filename to the database</param> | ||
119 | public DB4oUserManager(string db4odb) | ||
120 | { | ||
121 | dbfl = db4odb; | ||
122 | IObjectContainer database; | ||
123 | database = Db4oFactory.OpenFile(dbfl); | ||
124 | // Load to cache | ||
125 | IObjectSet result = database.Get(typeof(UserProfileData)); | ||
126 | foreach (UserProfileData row in result) | ||
127 | { | ||
128 | userProfiles.Add(row.UUID, row); | ||
129 | } | ||
130 | database.Close(); | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
134 | /// Adds a new profile to the database (Warning: Probably slow.) | ||
135 | /// </summary> | ||
136 | /// <param name="row">The profile to add</param> | ||
137 | /// <returns>Successful?</returns> | ||
138 | public bool AddRow(UserProfileData row) | ||
139 | { | ||
140 | if (userProfiles.ContainsKey(row.UUID)) | ||
141 | { | ||
142 | userProfiles[row.UUID] = row; | ||
143 | } | ||
144 | else | ||
145 | { | ||
146 | userProfiles.Add(row.UUID, row); | ||
147 | } | ||
148 | |||
149 | try | ||
150 | { | ||
151 | IObjectContainer database; | ||
152 | database = Db4oFactory.OpenFile(dbfl); | ||
153 | database.Set(row); | ||
154 | database.Close(); | ||
155 | return true; | ||
156 | } | ||
157 | catch (Exception e) | ||
158 | { | ||
159 | return false; | ||
160 | } | ||
161 | } | ||
162 | |||
163 | |||
164 | } | ||
165 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs deleted file mode 100644 index 315f48d..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/DB4oUserData.cs +++ /dev/null | |||
@@ -1,205 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using OpenGrid.Framework.Data; | ||
32 | using libsecondlife; | ||
33 | |||
34 | namespace OpenGrid.Framework.Data.DB4o | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// A User storage interface for the DB4o database system | ||
38 | /// </summary> | ||
39 | public class DB4oUserData : IUserData | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// The database manager | ||
43 | /// </summary> | ||
44 | DB4oUserManager manager; | ||
45 | |||
46 | /// <summary> | ||
47 | /// Artificial constructor called upon plugin load | ||
48 | /// </summary> | ||
49 | public void Initialise() | ||
50 | { | ||
51 | manager = new DB4oUserManager("userprofiles.yap"); | ||
52 | } | ||
53 | |||
54 | /// <summary> | ||
55 | /// Loads a specified user profile from a UUID | ||
56 | /// </summary> | ||
57 | /// <param name="uuid">The users UUID</param> | ||
58 | /// <returns>A user profile</returns> | ||
59 | public UserProfileData getUserByUUID(LLUUID uuid) | ||
60 | { | ||
61 | if(manager.userProfiles.ContainsKey(uuid)) | ||
62 | return manager.userProfiles[uuid]; | ||
63 | return null; | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Returns a user by searching for its name | ||
68 | /// </summary> | ||
69 | /// <param name="name">The users account name</param> | ||
70 | /// <returns>A matching users profile</returns> | ||
71 | public UserProfileData getUserByName(string name) | ||
72 | { | ||
73 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
74 | } | ||
75 | |||
76 | /// <summary> | ||
77 | /// Returns a user by searching for its name | ||
78 | /// </summary> | ||
79 | /// <param name="fname">The first part of the users account name</param> | ||
80 | /// <param name="lname">The second part of the users account name</param> | ||
81 | /// <returns>A matching users profile</returns> | ||
82 | public UserProfileData getUserByName(string fname, string lname) | ||
83 | { | ||
84 | foreach (UserProfileData profile in manager.userProfiles.Values) | ||
85 | { | ||
86 | if (profile.username == fname && profile.surname == lname) | ||
87 | return profile; | ||
88 | } | ||
89 | return null; | ||
90 | } | ||
91 | |||
92 | /// <summary> | ||
93 | /// Returns a user by UUID direct | ||
94 | /// </summary> | ||
95 | /// <param name="uuid">The users account ID</param> | ||
96 | /// <returns>A matching users profile</returns> | ||
97 | public UserAgentData getAgentByUUID(LLUUID uuid) | ||
98 | { | ||
99 | try | ||
100 | { | ||
101 | return getUserByUUID(uuid).currentAgent; | ||
102 | } | ||
103 | catch (Exception e) | ||
104 | { | ||
105 | return null; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | /// <summary> | ||
110 | /// Returns a session by account name | ||
111 | /// </summary> | ||
112 | /// <param name="name">The account name</param> | ||
113 | /// <returns>The users session agent</returns> | ||
114 | public UserAgentData getAgentByName(string name) | ||
115 | { | ||
116 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
117 | } | ||
118 | |||
119 | /// <summary> | ||
120 | /// Returns a session by account name | ||
121 | /// </summary> | ||
122 | /// <param name="fname">The first part of the users account name</param> | ||
123 | /// <param name="lname">The second part of the users account name</param> | ||
124 | /// <returns>A user agent</returns> | ||
125 | public UserAgentData getAgentByName(string fname, string lname) | ||
126 | { | ||
127 | try | ||
128 | { | ||
129 | return getUserByName(fname,lname).currentAgent; | ||
130 | } | ||
131 | catch (Exception e) | ||
132 | { | ||
133 | return null; | ||
134 | } | ||
135 | } | ||
136 | |||
137 | /// <summary> | ||
138 | /// Creates a new user profile | ||
139 | /// </summary> | ||
140 | /// <param name="user">The profile to add to the database</param> | ||
141 | public void addNewUserProfile(UserProfileData user) | ||
142 | { | ||
143 | try | ||
144 | { | ||
145 | manager.AddRow(user); | ||
146 | } | ||
147 | catch (Exception e) | ||
148 | { | ||
149 | Console.WriteLine(e.ToString()); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | /// <summary> | ||
154 | /// Creates a new user agent | ||
155 | /// </summary> | ||
156 | /// <param name="agent">The agent to add to the database</param> | ||
157 | public void addNewUserAgent(UserAgentData agent) | ||
158 | { | ||
159 | // Do nothing. yet. | ||
160 | } | ||
161 | |||
162 | /// <summary> | ||
163 | /// Transfers money between two user accounts | ||
164 | /// </summary> | ||
165 | /// <param name="from">Starting account</param> | ||
166 | /// <param name="to">End account</param> | ||
167 | /// <param name="amount">The amount to move</param> | ||
168 | /// <returns>Success?</returns> | ||
169 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | ||
170 | { | ||
171 | return true; | ||
172 | } | ||
173 | |||
174 | /// <summary> | ||
175 | /// Transfers inventory between two accounts | ||
176 | /// </summary> | ||
177 | /// <remarks>Move to inventory server</remarks> | ||
178 | /// <param name="from">Senders account</param> | ||
179 | /// <param name="to">Recievers account</param> | ||
180 | /// <param name="item">Inventory item</param> | ||
181 | /// <returns>Success?</returns> | ||
182 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | ||
183 | { | ||
184 | return true; | ||
185 | } | ||
186 | |||
187 | /// <summary> | ||
188 | /// Returns the name of the storage provider | ||
189 | /// </summary> | ||
190 | /// <returns>Storage provider name</returns> | ||
191 | public string getName() | ||
192 | { | ||
193 | return "DB4o Userdata"; | ||
194 | } | ||
195 | |||
196 | /// <summary> | ||
197 | /// Returns the version of the storage provider | ||
198 | /// </summary> | ||
199 | /// <returns>Storage provider version</returns> | ||
200 | public string getVersion() | ||
201 | { | ||
202 | return "0.1"; | ||
203 | } | ||
204 | } | ||
205 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj deleted file mode 100644 index d2d6140..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.csproj +++ /dev/null | |||
@@ -1,111 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{39BD9497-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenGrid.Framework.Data.DB4o</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data.DB4o</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="Db4objects.Db4o.dll" > | ||
62 | <HintPath>..\..\bin\Db4objects.Db4o.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="libsecondlife.dll" > | ||
66 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System" > | ||
70 | <HintPath>System.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Data" > | ||
74 | <HintPath>System.Data.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
84 | <Name>OpenGrid.Framework.Data</Name> | ||
85 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
87 | <Private>False</Private> | ||
88 | </ProjectReference> | ||
89 | </ItemGroup> | ||
90 | <ItemGroup> | ||
91 | <Compile Include="DB4oGridData.cs"> | ||
92 | <SubType>Code</SubType> | ||
93 | </Compile> | ||
94 | <Compile Include="DB4oManager.cs"> | ||
95 | <SubType>Code</SubType> | ||
96 | </Compile> | ||
97 | <Compile Include="DB4oUserData.cs"> | ||
98 | <SubType>Code</SubType> | ||
99 | </Compile> | ||
100 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
101 | <SubType>Code</SubType> | ||
102 | </Compile> | ||
103 | </ItemGroup> | ||
104 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
105 | <PropertyGroup> | ||
106 | <PreBuildEvent> | ||
107 | </PreBuildEvent> | ||
108 | <PostBuildEvent> | ||
109 | </PostBuildEvent> | ||
110 | </PropertyGroup> | ||
111 | </Project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build b/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build deleted file mode 100644 index d82d751..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/OpenGrid.Framework.Data.DB4o.dll.build +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenGrid.Framework.Data.DB4o" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenGrid.Framework.Data.DB4o" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="DB4oGridData.cs" /> | ||
15 | <include name="DB4oManager.cs" /> | ||
16 | <include name="DB4oUserData.cs" /> | ||
17 | <include name="Properties/AssemblyInfo.cs" /> | ||
18 | </sources> | ||
19 | <references basedir="${project::get-base-directory()}"> | ||
20 | <lib> | ||
21 | <include name="${project::get-base-directory()}" /> | ||
22 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
23 | </lib> | ||
24 | <include name="../../bin/Db4objects.Db4o.dll" /> | ||
25 | <include name="../../bin/libsecondlife.dll" /> | ||
26 | <include name="../../bin/OpenGrid.Framework.Data.dll" /> | ||
27 | <include name="System.dll" /> | ||
28 | <include name="System.Data.dll" /> | ||
29 | <include name="System.Xml.dll" /> | ||
30 | </references> | ||
31 | </csc> | ||
32 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
33 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
34 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
35 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
36 | <include name="*.dll"/> | ||
37 | <include name="*.exe"/> | ||
38 | </fileset> | ||
39 | </copy> | ||
40 | </target> | ||
41 | <target name="clean"> | ||
42 | <delete dir="${bin.dir}" failonerror="false" /> | ||
43 | <delete dir="${obj.dir}" failonerror="false" /> | ||
44 | </target> | ||
45 | <target name="doc" description="Creates documentation."> | ||
46 | </target> | ||
47 | </project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs deleted file mode 100644 index dc4a9a1..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.DB4o/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework.Data.DB4o")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Data.DB4o")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs deleted file mode 100644 index 92169c4..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLGridData.cs +++ /dev/null | |||
@@ -1,190 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using OpenGrid.Framework.Data; | ||
32 | |||
33 | namespace OpenGrid.Framework.Data.MSSQL | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A grid data interface for Microsoft SQL Server | ||
37 | /// </summary> | ||
38 | public class SqlGridData : IGridData | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Database manager | ||
42 | /// </summary> | ||
43 | private MSSqlManager database; | ||
44 | |||
45 | /// <summary> | ||
46 | /// Initialises the Grid Interface | ||
47 | /// </summary> | ||
48 | public void Initialise() | ||
49 | { | ||
50 | database = new MSSqlManager("localhost", "db", "user", "password", "false"); | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Shuts down the grid interface | ||
55 | /// </summary> | ||
56 | public void Close() | ||
57 | { | ||
58 | database.Close(); | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Returns the storage system name | ||
63 | /// </summary> | ||
64 | /// <returns>A string containing the storage system name</returns> | ||
65 | public string getName() | ||
66 | { | ||
67 | return "Sql OpenGridData"; | ||
68 | } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Returns the storage system version | ||
72 | /// </summary> | ||
73 | /// <returns>A string containing the storage system version</returns> | ||
74 | public string getVersion() | ||
75 | { | ||
76 | return "0.1"; | ||
77 | } | ||
78 | |||
79 | /// <summary> | ||
80 | /// Returns a list of regions within the specified ranges | ||
81 | /// </summary> | ||
82 | /// <param name="a">minimum X coordinate</param> | ||
83 | /// <param name="b">minimum Y coordinate</param> | ||
84 | /// <param name="c">maximum X coordinate</param> | ||
85 | /// <param name="d">maximum Y coordinate</param> | ||
86 | /// <returns>An array of region profiles</returns> | ||
87 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | ||
88 | { | ||
89 | return null; | ||
90 | } | ||
91 | |||
92 | /// <summary> | ||
93 | /// Returns a sim profile from it's location | ||
94 | /// </summary> | ||
95 | /// <param name="handle">Region location handle</param> | ||
96 | /// <returns>Sim profile</returns> | ||
97 | public SimProfileData GetProfileByHandle(ulong handle) | ||
98 | { | ||
99 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
100 | param["handle"] = handle.ToString(); | ||
101 | |||
102 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); | ||
103 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
104 | |||
105 | SimProfileData row = database.getRow(reader); | ||
106 | reader.Close(); | ||
107 | result.Dispose(); | ||
108 | |||
109 | return row; | ||
110 | } | ||
111 | |||
112 | /// <summary> | ||
113 | /// Returns a sim profile from it's UUID | ||
114 | /// </summary> | ||
115 | /// <param name="uuid">The region UUID</param> | ||
116 | /// <returns>The sim profile</returns> | ||
117 | public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) | ||
118 | { | ||
119 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
120 | param["uuid"] = uuid.ToStringHyphenated(); | ||
121 | |||
122 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); | ||
123 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
124 | |||
125 | SimProfileData row = database.getRow(reader); | ||
126 | reader.Close(); | ||
127 | result.Dispose(); | ||
128 | |||
129 | return row; | ||
130 | } | ||
131 | |||
132 | /// <summary> | ||
133 | /// Adds a new specified region to the database | ||
134 | /// </summary> | ||
135 | /// <param name="profile">The profile to add</param> | ||
136 | /// <returns>A dataresponse enum indicating success</returns> | ||
137 | public DataResponse AddProfile(SimProfileData profile) | ||
138 | { | ||
139 | if (database.insertRow(profile)) | ||
140 | { | ||
141 | return DataResponse.RESPONSE_OK; | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | return DataResponse.RESPONSE_ERROR; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | /// <summary> | ||
150 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | ||
151 | /// </summary> | ||
152 | /// <param name="uuid">The UUID of the challenger</param> | ||
153 | /// <param name="handle">The attempted regionHandle of the challenger</param> | ||
154 | /// <param name="authkey">The secret</param> | ||
155 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> | ||
156 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) | ||
157 | { | ||
158 | bool throwHissyFit = false; // Should be true by 1.0 | ||
159 | |||
160 | if (throwHissyFit) | ||
161 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); | ||
162 | |||
163 | SimProfileData data = GetProfileByLLUUID(uuid); | ||
164 | |||
165 | return (handle == data.regionHandle && authkey == data.regionSecret); | ||
166 | } | ||
167 | |||
168 | /// <summary> | ||
169 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region | ||
170 | /// </summary> | ||
171 | /// <remarks>This requires a security audit.</remarks> | ||
172 | /// <param name="uuid"></param> | ||
173 | /// <param name="handle"></param> | ||
174 | /// <param name="authhash"></param> | ||
175 | /// <param name="challenge"></param> | ||
176 | /// <returns></returns> | ||
177 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) | ||
178 | { | ||
179 | System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); | ||
180 | System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); | ||
181 | |||
182 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | ||
183 | byte[] hash = HashProvider.ComputeHash(stream); | ||
184 | |||
185 | return false; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | |||
190 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs deleted file mode 100644 index 475a3e7..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs +++ /dev/null | |||
@@ -1,214 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using System.Data; | ||
32 | |||
33 | using System.Data.SqlClient; | ||
34 | |||
35 | using OpenGrid.Framework.Data; | ||
36 | |||
37 | namespace OpenGrid.Framework.Data.MSSQL | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// A management class for the MS SQL Storage Engine | ||
41 | /// </summary> | ||
42 | class MSSqlManager | ||
43 | { | ||
44 | /// <summary> | ||
45 | /// The database connection object | ||
46 | /// </summary> | ||
47 | IDbConnection dbcon; | ||
48 | |||
49 | /// <summary> | ||
50 | /// Initialises and creates a new Sql connection and maintains it. | ||
51 | /// </summary> | ||
52 | /// <param name="hostname">The Sql server being connected to</param> | ||
53 | /// <param name="database">The name of the Sql database being used</param> | ||
54 | /// <param name="username">The username logging into the database</param> | ||
55 | /// <param name="password">The password for the user logging in</param> | ||
56 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> | ||
57 | public MSSqlManager(string hostname, string database, string username, string password, string cpooling) | ||
58 | { | ||
59 | try | ||
60 | { | ||
61 | string connectionString = "Server=" + hostname + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; | ||
62 | dbcon = new SqlConnection(connectionString); | ||
63 | |||
64 | dbcon.Open(); | ||
65 | } | ||
66 | catch (Exception e) | ||
67 | { | ||
68 | throw new Exception("Error initialising Sql Database: " + e.ToString()); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | /// <summary> | ||
73 | /// Shuts down the database connection | ||
74 | /// </summary> | ||
75 | public void Close() | ||
76 | { | ||
77 | dbcon.Close(); | ||
78 | dbcon = null; | ||
79 | } | ||
80 | |||
81 | /// <summary> | ||
82 | /// Runs a query with protection against SQL Injection by using parameterised input. | ||
83 | /// </summary> | ||
84 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | ||
85 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | ||
86 | /// <returns>A Sql DB Command</returns> | ||
87 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | ||
88 | { | ||
89 | SqlCommand dbcommand = (SqlCommand)dbcon.CreateCommand(); | ||
90 | dbcommand.CommandText = sql; | ||
91 | foreach (KeyValuePair<string, string> param in parameters) | ||
92 | { | ||
93 | dbcommand.Parameters.AddWithValue(param.Key, param.Value); | ||
94 | } | ||
95 | |||
96 | return (IDbCommand)dbcommand; | ||
97 | } | ||
98 | |||
99 | /// <summary> | ||
100 | /// Runs a database reader object and returns a region row | ||
101 | /// </summary> | ||
102 | /// <param name="reader">An active database reader</param> | ||
103 | /// <returns>A region row</returns> | ||
104 | public SimProfileData getRow(IDataReader reader) | ||
105 | { | ||
106 | SimProfileData regionprofile = new SimProfileData(); | ||
107 | |||
108 | if (reader.Read()) | ||
109 | { | ||
110 | // Region Main | ||
111 | regionprofile.regionHandle = (ulong)reader["regionHandle"]; | ||
112 | regionprofile.regionName = (string)reader["regionName"]; | ||
113 | regionprofile.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); | ||
114 | |||
115 | // Secrets | ||
116 | regionprofile.regionRecvKey = (string)reader["regionRecvKey"]; | ||
117 | regionprofile.regionSecret = (string)reader["regionSecret"]; | ||
118 | regionprofile.regionSendKey = (string)reader["regionSendKey"]; | ||
119 | |||
120 | // Region Server | ||
121 | regionprofile.regionDataURI = (string)reader["regionDataURI"]; | ||
122 | regionprofile.regionOnline = false; // Needs to be pinged before this can be set. | ||
123 | regionprofile.serverIP = (string)reader["serverIP"]; | ||
124 | regionprofile.serverPort = (uint)reader["serverPort"]; | ||
125 | regionprofile.serverURI = (string)reader["serverURI"]; | ||
126 | |||
127 | // Location | ||
128 | regionprofile.regionLocX = (uint)((int)reader["locX"]); | ||
129 | regionprofile.regionLocY = (uint)((int)reader["locY"]); | ||
130 | regionprofile.regionLocZ = (uint)((int)reader["locZ"]); | ||
131 | |||
132 | // Neighbours - 0 = No Override | ||
133 | regionprofile.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; | ||
134 | regionprofile.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; | ||
135 | regionprofile.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; | ||
136 | regionprofile.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; | ||
137 | |||
138 | // Assets | ||
139 | regionprofile.regionAssetURI = (string)reader["regionAssetURI"]; | ||
140 | regionprofile.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | ||
141 | regionprofile.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | ||
142 | |||
143 | // Userserver | ||
144 | regionprofile.regionUserURI = (string)reader["regionUserURI"]; | ||
145 | regionprofile.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | ||
146 | regionprofile.regionUserSendKey = (string)reader["regionUserSendKey"]; | ||
147 | } | ||
148 | else | ||
149 | { | ||
150 | throw new Exception("No rows to return"); | ||
151 | } | ||
152 | return regionprofile; | ||
153 | } | ||
154 | |||
155 | /// <summary> | ||
156 | /// Creates a new region in the database | ||
157 | /// </summary> | ||
158 | /// <param name="profile">The region profile to insert</param> | ||
159 | /// <returns>Successful?</returns> | ||
160 | public bool insertRow(SimProfileData profile) | ||
161 | { | ||
162 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | ||
163 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | ||
164 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; | ||
165 | |||
166 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | ||
167 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | ||
168 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; | ||
169 | |||
170 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
171 | |||
172 | parameters["regionHandle"] = profile.regionHandle.ToString(); | ||
173 | parameters["regionName"] = profile.regionName; | ||
174 | parameters["uuid"] = profile.UUID.ToString(); | ||
175 | parameters["regionRecvKey"] = profile.regionRecvKey; | ||
176 | parameters["regionSendKey"] = profile.regionSendKey; | ||
177 | parameters["regionDataURI"] = profile.regionDataURI; | ||
178 | parameters["serverIP"] = profile.serverIP; | ||
179 | parameters["serverPort"] = profile.serverPort.ToString(); | ||
180 | parameters["serverURI"] = profile.serverURI; | ||
181 | parameters["locX"] = profile.regionLocX.ToString(); | ||
182 | parameters["locY"] = profile.regionLocY.ToString(); | ||
183 | parameters["locZ"] = profile.regionLocZ.ToString(); | ||
184 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); | ||
185 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); | ||
186 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); | ||
187 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); | ||
188 | parameters["regionAssetURI"] = profile.regionAssetURI; | ||
189 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; | ||
190 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; | ||
191 | parameters["regionUserURI"] = profile.regionUserURI; | ||
192 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; | ||
193 | parameters["regionUserSendKey"] = profile.regionUserSendKey; | ||
194 | |||
195 | bool returnval = false; | ||
196 | |||
197 | try | ||
198 | { | ||
199 | IDbCommand result = Query(sql, parameters); | ||
200 | |||
201 | if (result.ExecuteNonQuery() == 1) | ||
202 | returnval = true; | ||
203 | |||
204 | result.Dispose(); | ||
205 | } | ||
206 | catch (Exception e) | ||
207 | { | ||
208 | return false; | ||
209 | } | ||
210 | |||
211 | return returnval; | ||
212 | } | ||
213 | } | ||
214 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj deleted file mode 100644 index fa18c28..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.csproj +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{0A563AC1-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenGrid.Framework.Data.MSSQL</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data.MSSQL</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Data" > | ||
70 | <HintPath>System.Data.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Xml" > | ||
74 | <HintPath>System.Xml.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
80 | <Name>OpenGrid.Framework.Data</Name> | ||
81 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
82 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
83 | <Private>False</Private> | ||
84 | </ProjectReference> | ||
85 | </ItemGroup> | ||
86 | <ItemGroup> | ||
87 | <Compile Include="MSSQLGridData.cs"> | ||
88 | <SubType>Code</SubType> | ||
89 | </Compile> | ||
90 | <Compile Include="MSSQLManager.cs"> | ||
91 | <SubType>Code</SubType> | ||
92 | </Compile> | ||
93 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
94 | <SubType>Code</SubType> | ||
95 | </Compile> | ||
96 | </ItemGroup> | ||
97 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
98 | <PropertyGroup> | ||
99 | <PreBuildEvent> | ||
100 | </PreBuildEvent> | ||
101 | <PostBuildEvent> | ||
102 | </PostBuildEvent> | ||
103 | </PropertyGroup> | ||
104 | </Project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build deleted file mode 100644 index 577da4b..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/OpenGrid.Framework.Data.MSSQL.dll.build +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenGrid.Framework.Data.MSSQL" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenGrid.Framework.Data.MSSQL" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="MSSQLGridData.cs" /> | ||
15 | <include name="MSSQLManager.cs" /> | ||
16 | <include name="Properties/AssemblyInfo.cs" /> | ||
17 | </sources> | ||
18 | <references basedir="${project::get-base-directory()}"> | ||
19 | <lib> | ||
20 | <include name="${project::get-base-directory()}" /> | ||
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
22 | </lib> | ||
23 | <include name="../../bin/libsecondlife.dll" /> | ||
24 | <include name="../../bin/OpenGrid.Framework.Data.dll" /> | ||
25 | <include name="System.dll" /> | ||
26 | <include name="System.Data.dll" /> | ||
27 | <include name="System.Xml.dll" /> | ||
28 | </references> | ||
29 | </csc> | ||
30 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
31 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
32 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
33 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
34 | <include name="*.dll"/> | ||
35 | <include name="*.exe"/> | ||
36 | </fileset> | ||
37 | </copy> | ||
38 | </target> | ||
39 | <target name="clean"> | ||
40 | <delete dir="${bin.dir}" failonerror="false" /> | ||
41 | <delete dir="${obj.dir}" failonerror="false" /> | ||
42 | </target> | ||
43 | <target name="doc" description="Creates documentation."> | ||
44 | </target> | ||
45 | </project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs deleted file mode 100644 index bbe3cdf..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework.Data.MSSQL")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Data.MSSQL")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs deleted file mode 100644 index d9a517d..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs +++ /dev/null | |||
@@ -1,258 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using OpenGrid.Framework.Data; | ||
32 | |||
33 | namespace OpenGrid.Framework.Data.MySQL | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A MySQL Interface for the Grid Server | ||
37 | /// </summary> | ||
38 | public class MySQLGridData : IGridData | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// MySQL Database Manager | ||
42 | /// </summary> | ||
43 | private MySQLManager database; | ||
44 | |||
45 | /// <summary> | ||
46 | /// Initialises the Grid Interface | ||
47 | /// </summary> | ||
48 | public void Initialise() | ||
49 | { | ||
50 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | ||
51 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | ||
52 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | ||
53 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | ||
54 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | ||
55 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | ||
56 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | ||
57 | |||
58 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Shuts down the grid interface | ||
63 | /// </summary> | ||
64 | public void Close() | ||
65 | { | ||
66 | database.Close(); | ||
67 | } | ||
68 | |||
69 | /// <summary> | ||
70 | /// Returns the plugin name | ||
71 | /// </summary> | ||
72 | /// <returns>Plugin name</returns> | ||
73 | public string getName() | ||
74 | { | ||
75 | return "MySql OpenGridData"; | ||
76 | } | ||
77 | |||
78 | /// <summary> | ||
79 | /// Returns the plugin version | ||
80 | /// </summary> | ||
81 | /// <returns>Plugin version</returns> | ||
82 | public string getVersion() | ||
83 | { | ||
84 | return "0.1"; | ||
85 | } | ||
86 | |||
87 | /// <summary> | ||
88 | /// Returns all the specified region profiles within coordates -- coordinates are inclusive | ||
89 | /// </summary> | ||
90 | /// <param name="xmin">Minimum X coordinate</param> | ||
91 | /// <param name="ymin">Minimum Y coordinate</param> | ||
92 | /// <param name="xmax">Maximum X coordinate</param> | ||
93 | /// <param name="ymax">Maximum Y coordinate</param> | ||
94 | /// <returns></returns> | ||
95 | public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax) | ||
96 | { | ||
97 | try | ||
98 | { | ||
99 | lock (database) | ||
100 | { | ||
101 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
102 | param["?xmin"] = xmin.ToString(); | ||
103 | param["?ymin"] = ymin.ToString(); | ||
104 | param["?xmax"] = xmax.ToString(); | ||
105 | param["?ymax"] = ymax.ToString(); | ||
106 | |||
107 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax", param); | ||
108 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
109 | |||
110 | SimProfileData row; | ||
111 | |||
112 | List<SimProfileData> rows = new List<SimProfileData>(); | ||
113 | |||
114 | while ((row = database.readSimRow(reader)) != null) | ||
115 | { | ||
116 | rows.Add(row); | ||
117 | } | ||
118 | reader.Close(); | ||
119 | result.Dispose(); | ||
120 | |||
121 | return rows.ToArray(); | ||
122 | |||
123 | } | ||
124 | } | ||
125 | catch (Exception e) | ||
126 | { | ||
127 | database.Reconnect(); | ||
128 | Console.WriteLine(e.ToString()); | ||
129 | return null; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
134 | /// Returns a sim profile from it's location | ||
135 | /// </summary> | ||
136 | /// <param name="handle">Region location handle</param> | ||
137 | /// <returns>Sim profile</returns> | ||
138 | public SimProfileData GetProfileByHandle(ulong handle) | ||
139 | { | ||
140 | try | ||
141 | { | ||
142 | lock (database) | ||
143 | { | ||
144 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
145 | param["?handle"] = handle.ToString(); | ||
146 | |||
147 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param); | ||
148 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
149 | |||
150 | SimProfileData row = database.readSimRow(reader); | ||
151 | reader.Close(); | ||
152 | result.Dispose(); | ||
153 | |||
154 | return row; | ||
155 | } | ||
156 | } | ||
157 | catch (Exception e) | ||
158 | { | ||
159 | database.Reconnect(); | ||
160 | Console.WriteLine(e.ToString()); | ||
161 | return null; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | /// <summary> | ||
166 | /// Returns a sim profile from it's UUID | ||
167 | /// </summary> | ||
168 | /// <param name="uuid">The region UUID</param> | ||
169 | /// <returns>The sim profile</returns> | ||
170 | public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) | ||
171 | { | ||
172 | try | ||
173 | { | ||
174 | lock (database) | ||
175 | { | ||
176 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
177 | param["?uuid"] = uuid.ToStringHyphenated(); | ||
178 | |||
179 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param); | ||
180 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
181 | |||
182 | SimProfileData row = database.readSimRow(reader); | ||
183 | reader.Close(); | ||
184 | result.Dispose(); | ||
185 | |||
186 | return row; | ||
187 | } | ||
188 | } | ||
189 | catch (Exception e) | ||
190 | { | ||
191 | database.Reconnect(); | ||
192 | Console.WriteLine(e.ToString()); | ||
193 | return null; | ||
194 | } | ||
195 | } | ||
196 | |||
197 | /// <summary> | ||
198 | /// Adds a new profile to the database | ||
199 | /// </summary> | ||
200 | /// <param name="profile">The profile to add</param> | ||
201 | /// <returns>Successful?</returns> | ||
202 | public DataResponse AddProfile(SimProfileData profile) | ||
203 | { | ||
204 | lock (database) | ||
205 | { | ||
206 | if (database.insertRegion(profile)) | ||
207 | { | ||
208 | return DataResponse.RESPONSE_OK; | ||
209 | } | ||
210 | else | ||
211 | { | ||
212 | return DataResponse.RESPONSE_ERROR; | ||
213 | } | ||
214 | } | ||
215 | } | ||
216 | |||
217 | /// <summary> | ||
218 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | ||
219 | /// </summary> | ||
220 | /// <param name="uuid">The UUID of the challenger</param> | ||
221 | /// <param name="handle">The attempted regionHandle of the challenger</param> | ||
222 | /// <param name="authkey">The secret</param> | ||
223 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> | ||
224 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) | ||
225 | { | ||
226 | bool throwHissyFit = false; // Should be true by 1.0 | ||
227 | |||
228 | if (throwHissyFit) | ||
229 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); | ||
230 | |||
231 | SimProfileData data = GetProfileByLLUUID(uuid); | ||
232 | |||
233 | return (handle == data.regionHandle && authkey == data.regionSecret); | ||
234 | } | ||
235 | |||
236 | /// <summary> | ||
237 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region | ||
238 | /// </summary> | ||
239 | /// <remarks>This requires a security audit.</remarks> | ||
240 | /// <param name="uuid"></param> | ||
241 | /// <param name="handle"></param> | ||
242 | /// <param name="authhash"></param> | ||
243 | /// <param name="challenge"></param> | ||
244 | /// <returns></returns> | ||
245 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) | ||
246 | { | ||
247 | System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); | ||
248 | System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); | ||
249 | |||
250 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | ||
251 | byte[] hash = HashProvider.ComputeHash(stream); | ||
252 | |||
253 | return false; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | |||
258 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs deleted file mode 100644 index fb429e4..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs +++ /dev/null | |||
@@ -1,309 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenGrid.Framework.Data.MySQL | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A MySQL interface for the inventory server | ||
37 | /// </summary> | ||
38 | class MySQLInventoryData : IInventoryData | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// The database manager | ||
42 | /// </summary> | ||
43 | public MySQLManager database; | ||
44 | |||
45 | /// <summary> | ||
46 | /// Loads and initialises this database plugin | ||
47 | /// </summary> | ||
48 | public void Initialise() | ||
49 | { | ||
50 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | ||
51 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | ||
52 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | ||
53 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | ||
54 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | ||
55 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | ||
56 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | ||
57 | |||
58 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// The name of this DB provider | ||
63 | /// </summary> | ||
64 | /// <returns>Name of DB provider</returns> | ||
65 | public string getName() | ||
66 | { | ||
67 | return "MySQL Inventory Data Interface"; | ||
68 | } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Closes this DB provider | ||
72 | /// </summary> | ||
73 | public void Close() | ||
74 | { | ||
75 | // Do nothing. | ||
76 | } | ||
77 | |||
78 | /// <summary> | ||
79 | /// Returns the version of this DB provider | ||
80 | /// </summary> | ||
81 | /// <returns>A string containing the DB provider</returns> | ||
82 | public string getVersion() | ||
83 | { | ||
84 | return "0.1"; | ||
85 | } | ||
86 | |||
87 | /// <summary> | ||
88 | /// Returns a list of items in a specified folder | ||
89 | /// </summary> | ||
90 | /// <param name="folderID">The folder to search</param> | ||
91 | /// <returns>A list containing inventory items</returns> | ||
92 | public List<InventoryItemBase> getInventoryInFolder(LLUUID folderID) | ||
93 | { | ||
94 | try | ||
95 | { | ||
96 | lock (database) | ||
97 | { | ||
98 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
99 | param["?uuid"] = folderID.ToStringHyphenated(); | ||
100 | |||
101 | System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE parentFolderID = ?uuid", param); | ||
102 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
103 | |||
104 | List<InventoryItemBase> items = database.readInventoryItems(reader); | ||
105 | |||
106 | reader.Close(); | ||
107 | result.Dispose(); | ||
108 | |||
109 | return items; | ||
110 | } | ||
111 | } | ||
112 | catch (Exception e) | ||
113 | { | ||
114 | database.Reconnect(); | ||
115 | Console.WriteLine(e.ToString()); | ||
116 | return null; | ||
117 | } | ||
118 | } | ||
119 | |||
120 | /// <summary> | ||
121 | /// Returns a list of the root folders within a users inventory | ||
122 | /// </summary> | ||
123 | /// <param name="user">The user whos inventory is to be searched</param> | ||
124 | /// <returns>A list of folder objects</returns> | ||
125 | public List<InventoryFolderBase> getUserRootFolders(LLUUID user) | ||
126 | { | ||
127 | try | ||
128 | { | ||
129 | lock (database) | ||
130 | { | ||
131 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
132 | param["?uuid"] = user.ToStringHyphenated(); | ||
133 | param["?zero"] = LLUUID.Zero.ToStringHyphenated(); | ||
134 | |||
135 | System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); | ||
136 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
137 | |||
138 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); | ||
139 | |||
140 | reader.Close(); | ||
141 | result.Dispose(); | ||
142 | |||
143 | return items; | ||
144 | } | ||
145 | } | ||
146 | catch (Exception e) | ||
147 | { | ||
148 | database.Reconnect(); | ||
149 | Console.WriteLine(e.ToString()); | ||
150 | return null; | ||
151 | } | ||
152 | } | ||
153 | |||
154 | /// <summary> | ||
155 | /// Returns a list of folders in a users inventory contained within the specified folder | ||
156 | /// </summary> | ||
157 | /// <param name="parentID">The folder to search</param> | ||
158 | /// <returns>A list of inventory folders</returns> | ||
159 | public List<InventoryFolderBase> getInventoryFolders(LLUUID parentID) | ||
160 | { | ||
161 | try | ||
162 | { | ||
163 | lock (database) | ||
164 | { | ||
165 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
166 | param["?uuid"] = parentID.ToStringHyphenated(); | ||
167 | |||
168 | System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?uuid", param); | ||
169 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
170 | |||
171 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); | ||
172 | |||
173 | reader.Close(); | ||
174 | result.Dispose(); | ||
175 | |||
176 | return items; | ||
177 | } | ||
178 | } | ||
179 | catch (Exception e) | ||
180 | { | ||
181 | database.Reconnect(); | ||
182 | Console.WriteLine(e.ToString()); | ||
183 | return null; | ||
184 | } | ||
185 | } | ||
186 | |||
187 | /// <summary> | ||
188 | /// Returns a specified inventory item | ||
189 | /// </summary> | ||
190 | /// <param name="item">The item to return</param> | ||
191 | /// <returns>An inventory item</returns> | ||
192 | public InventoryItemBase getInventoryItem(LLUUID item) | ||
193 | { | ||
194 | try | ||
195 | { | ||
196 | lock (database) | ||
197 | { | ||
198 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
199 | param["?uuid"] = item.ToStringHyphenated(); | ||
200 | |||
201 | System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryitems WHERE inventoryID = ?uuid", param); | ||
202 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
203 | |||
204 | List<InventoryItemBase> items = database.readInventoryItems(reader); | ||
205 | |||
206 | reader.Close(); | ||
207 | result.Dispose(); | ||
208 | |||
209 | if (items.Count > 0) | ||
210 | { | ||
211 | return items[0]; | ||
212 | } | ||
213 | else | ||
214 | { | ||
215 | return null; | ||
216 | } | ||
217 | } | ||
218 | } | ||
219 | catch (Exception e) | ||
220 | { | ||
221 | database.Reconnect(); | ||
222 | Console.WriteLine(e.ToString()); | ||
223 | return null; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | /// <summary> | ||
228 | /// Returns a specified inventory folder | ||
229 | /// </summary> | ||
230 | /// <param name="folder">The folder to return</param> | ||
231 | /// <returns>A folder class</returns> | ||
232 | public InventoryFolderBase getInventoryFolder(LLUUID folder) | ||
233 | { | ||
234 | try | ||
235 | { | ||
236 | lock (database) | ||
237 | { | ||
238 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
239 | param["?uuid"] = folder.ToStringHyphenated(); | ||
240 | |||
241 | System.Data.IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE folderID = ?uuid", param); | ||
242 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
243 | |||
244 | List<InventoryFolderBase> items = database.readInventoryFolders(reader); | ||
245 | |||
246 | reader.Close(); | ||
247 | result.Dispose(); | ||
248 | |||
249 | if (items.Count > 0) | ||
250 | { | ||
251 | return items[0]; | ||
252 | } | ||
253 | else | ||
254 | { | ||
255 | return null; | ||
256 | } | ||
257 | } | ||
258 | } | ||
259 | catch (Exception e) | ||
260 | { | ||
261 | database.Reconnect(); | ||
262 | Console.WriteLine(e.ToString()); | ||
263 | return null; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | /// <summary> | ||
268 | /// Adds a specified item to the database | ||
269 | /// </summary> | ||
270 | /// <param name="item">The inventory item</param> | ||
271 | public void addInventoryItem(InventoryItemBase item) | ||
272 | { | ||
273 | lock (database) | ||
274 | { | ||
275 | database.insertItem(item); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | /// <summary> | ||
280 | /// Updates the specified inventory item | ||
281 | /// </summary> | ||
282 | /// <param name="item">Inventory item to update</param> | ||
283 | public void updateInventoryItem(InventoryItemBase item) | ||
284 | { | ||
285 | addInventoryItem(item); | ||
286 | } | ||
287 | |||
288 | /// <summary> | ||
289 | /// Creates a new inventory folder | ||
290 | /// </summary> | ||
291 | /// <param name="folder">Folder to create</param> | ||
292 | public void addInventoryFolder(InventoryFolderBase folder) | ||
293 | { | ||
294 | lock (database) | ||
295 | { | ||
296 | database.insertFolder(folder); | ||
297 | } | ||
298 | } | ||
299 | |||
300 | /// <summary> | ||
301 | /// Updates an inventory folder | ||
302 | /// </summary> | ||
303 | /// <param name="folder">Folder to update</param> | ||
304 | public void updateInventoryFolder(InventoryFolderBase folder) | ||
305 | { | ||
306 | addInventoryFolder(folder); | ||
307 | } | ||
308 | } | ||
309 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs deleted file mode 100644 index c88b39f..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | |||
32 | namespace OpenGrid.Framework.Data.MySQL | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// An interface to the log database for MySQL | ||
36 | /// </summary> | ||
37 | class MySQLLogData : ILogData | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// The database manager | ||
41 | /// </summary> | ||
42 | public MySQLManager database; | ||
43 | |||
44 | /// <summary> | ||
45 | /// Artificial constructor called when the plugin is loaded | ||
46 | /// </summary> | ||
47 | public void Initialise() | ||
48 | { | ||
49 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | ||
50 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | ||
51 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | ||
52 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | ||
53 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | ||
54 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | ||
55 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | ||
56 | |||
57 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | ||
58 | } | ||
59 | |||
60 | /// <summary> | ||
61 | /// Saves a log item to the database | ||
62 | /// </summary> | ||
63 | /// <param name="serverDaemon">The daemon triggering the event</param> | ||
64 | /// <param name="target">The target of the action (region / agent UUID, etc)</param> | ||
65 | /// <param name="methodCall">The method call where the problem occured</param> | ||
66 | /// <param name="arguments">The arguments passed to the method</param> | ||
67 | /// <param name="priority">How critical is this?</param> | ||
68 | /// <param name="logMessage">The message to log</param> | ||
69 | public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) | ||
70 | { | ||
71 | try | ||
72 | { | ||
73 | database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage); | ||
74 | } | ||
75 | catch (Exception e) | ||
76 | { | ||
77 | database.Reconnect(); | ||
78 | } | ||
79 | } | ||
80 | |||
81 | /// <summary> | ||
82 | /// Returns the name of this DB provider | ||
83 | /// </summary> | ||
84 | /// <returns>A string containing the DB provider name</returns> | ||
85 | public string getName() | ||
86 | { | ||
87 | return "MySQL Logdata Interface"; | ||
88 | } | ||
89 | |||
90 | /// <summary> | ||
91 | /// Closes the database provider | ||
92 | /// </summary> | ||
93 | public void Close() | ||
94 | { | ||
95 | // Do nothing. | ||
96 | } | ||
97 | |||
98 | /// <summary> | ||
99 | /// Returns the version of this DB provider | ||
100 | /// </summary> | ||
101 | /// <returns>A string containing the provider version</returns> | ||
102 | public string getVersion() | ||
103 | { | ||
104 | return "0.1"; | ||
105 | } | ||
106 | } | ||
107 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs deleted file mode 100644 index b42ec09..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs +++ /dev/null | |||
@@ -1,665 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using System.Data; | ||
32 | |||
33 | // MySQL Native | ||
34 | using MySql; | ||
35 | using MySql.Data; | ||
36 | using MySql.Data.Types; | ||
37 | using MySql.Data.MySqlClient; | ||
38 | |||
39 | using OpenGrid.Framework.Data; | ||
40 | |||
41 | namespace OpenGrid.Framework.Data.MySQL | ||
42 | { | ||
43 | /// <summary> | ||
44 | /// A MySQL Database manager | ||
45 | /// </summary> | ||
46 | class MySQLManager | ||
47 | { | ||
48 | /// <summary> | ||
49 | /// The database connection object | ||
50 | /// </summary> | ||
51 | IDbConnection dbcon; | ||
52 | /// <summary> | ||
53 | /// Connection string for ADO.net | ||
54 | /// </summary> | ||
55 | string connectionString; | ||
56 | |||
57 | /// <summary> | ||
58 | /// Initialises and creates a new MySQL connection and maintains it. | ||
59 | /// </summary> | ||
60 | /// <param name="hostname">The MySQL server being connected to</param> | ||
61 | /// <param name="database">The name of the MySQL database being used</param> | ||
62 | /// <param name="username">The username logging into the database</param> | ||
63 | /// <param name="password">The password for the user logging in</param> | ||
64 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> | ||
65 | public MySQLManager(string hostname, string database, string username, string password, string cpooling, string port) | ||
66 | { | ||
67 | try | ||
68 | { | ||
69 | connectionString = "Server=" + hostname + ";Port=" + port + ";Database=" + database + ";User ID=" + username + ";Password=" + password + ";Pooling=" + cpooling + ";"; | ||
70 | dbcon = new MySqlConnection(connectionString); | ||
71 | |||
72 | dbcon.Open(); | ||
73 | |||
74 | System.Console.WriteLine("MySQL connection established"); | ||
75 | } | ||
76 | catch (Exception e) | ||
77 | { | ||
78 | throw new Exception("Error initialising MySql Database: " + e.ToString()); | ||
79 | } | ||
80 | } | ||
81 | |||
82 | /// <summary> | ||
83 | /// Shuts down the database connection | ||
84 | /// </summary> | ||
85 | public void Close() | ||
86 | { | ||
87 | dbcon.Close(); | ||
88 | dbcon = null; | ||
89 | } | ||
90 | |||
91 | /// <summary> | ||
92 | /// Reconnects to the database | ||
93 | /// </summary> | ||
94 | public void Reconnect() | ||
95 | { | ||
96 | lock (dbcon) | ||
97 | { | ||
98 | try | ||
99 | { | ||
100 | // Close the DB connection | ||
101 | dbcon.Close(); | ||
102 | // Try reopen it | ||
103 | dbcon = new MySqlConnection(connectionString); | ||
104 | dbcon.Open(); | ||
105 | } | ||
106 | catch (Exception e) | ||
107 | { | ||
108 | Console.WriteLine("Unable to reconnect to database " + e.ToString()); | ||
109 | } | ||
110 | } | ||
111 | } | ||
112 | |||
113 | /// <summary> | ||
114 | /// Runs a query with protection against SQL Injection by using parameterised input. | ||
115 | /// </summary> | ||
116 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | ||
117 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | ||
118 | /// <returns>A MySQL DB Command</returns> | ||
119 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | ||
120 | { | ||
121 | try | ||
122 | { | ||
123 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); | ||
124 | dbcommand.CommandText = sql; | ||
125 | foreach (KeyValuePair<string, string> param in parameters) | ||
126 | { | ||
127 | dbcommand.Parameters.Add(param.Key, param.Value); | ||
128 | } | ||
129 | |||
130 | return (IDbCommand)dbcommand; | ||
131 | } | ||
132 | catch | ||
133 | { | ||
134 | lock (dbcon) | ||
135 | { | ||
136 | // Close the DB connection | ||
137 | try | ||
138 | { | ||
139 | dbcon.Close(); | ||
140 | } | ||
141 | catch { } | ||
142 | |||
143 | // Try reopen it | ||
144 | try | ||
145 | { | ||
146 | dbcon = new MySqlConnection(connectionString); | ||
147 | dbcon.Open(); | ||
148 | } | ||
149 | catch (Exception e) | ||
150 | { | ||
151 | Console.WriteLine("Unable to reconnect to database " + e.ToString()); | ||
152 | } | ||
153 | |||
154 | // Run the query again | ||
155 | try | ||
156 | { | ||
157 | MySqlCommand dbcommand = (MySqlCommand)dbcon.CreateCommand(); | ||
158 | dbcommand.CommandText = sql; | ||
159 | foreach (KeyValuePair<string, string> param in parameters) | ||
160 | { | ||
161 | dbcommand.Parameters.Add(param.Key, param.Value); | ||
162 | } | ||
163 | |||
164 | return (IDbCommand)dbcommand; | ||
165 | } | ||
166 | catch (Exception e) | ||
167 | { | ||
168 | // Return null if it fails. | ||
169 | Console.WriteLine("Failed during Query generation: " + e.ToString()); | ||
170 | return null; | ||
171 | } | ||
172 | } | ||
173 | } | ||
174 | } | ||
175 | |||
176 | /// <summary> | ||
177 | /// Reads a region row from a database reader | ||
178 | /// </summary> | ||
179 | /// <param name="reader">An active database reader</param> | ||
180 | /// <returns>A region profile</returns> | ||
181 | public SimProfileData readSimRow(IDataReader reader) | ||
182 | { | ||
183 | SimProfileData retval = new SimProfileData(); | ||
184 | |||
185 | if (reader.Read()) | ||
186 | { | ||
187 | // Region Main | ||
188 | retval.regionHandle = Convert.ToUInt64(reader["regionHandle"].ToString()); | ||
189 | retval.regionName = (string)reader["regionName"]; | ||
190 | retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); | ||
191 | |||
192 | // Secrets | ||
193 | retval.regionRecvKey = (string)reader["regionRecvKey"]; | ||
194 | retval.regionSecret = (string)reader["regionSecret"]; | ||
195 | retval.regionSendKey = (string)reader["regionSendKey"]; | ||
196 | |||
197 | // Region Server | ||
198 | retval.regionDataURI = (string)reader["regionDataURI"]; | ||
199 | retval.regionOnline = false; // Needs to be pinged before this can be set. | ||
200 | retval.serverIP = (string)reader["serverIP"]; | ||
201 | retval.serverPort = (uint)reader["serverPort"]; | ||
202 | retval.serverURI = (string)reader["serverURI"]; | ||
203 | |||
204 | // Location | ||
205 | retval.regionLocX = Convert.ToUInt32(reader["locX"].ToString()); | ||
206 | retval.regionLocY = Convert.ToUInt32(reader["locY"].ToString()); | ||
207 | retval.regionLocZ = Convert.ToUInt32(reader["locZ"].ToString()); | ||
208 | |||
209 | // Neighbours - 0 = No Override | ||
210 | retval.regionEastOverrideHandle = Convert.ToUInt64(reader["eastOverrideHandle"].ToString()); | ||
211 | retval.regionWestOverrideHandle = Convert.ToUInt64(reader["westOverrideHandle"].ToString()); | ||
212 | retval.regionSouthOverrideHandle = Convert.ToUInt64(reader["southOverrideHandle"].ToString()); | ||
213 | retval.regionNorthOverrideHandle = Convert.ToUInt64(reader["northOverrideHandle"].ToString()); | ||
214 | |||
215 | // Assets | ||
216 | retval.regionAssetURI = (string)reader["regionAssetURI"]; | ||
217 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | ||
218 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | ||
219 | |||
220 | // Userserver | ||
221 | retval.regionUserURI = (string)reader["regionUserURI"]; | ||
222 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | ||
223 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; | ||
224 | |||
225 | // World Map Addition | ||
226 | string tempRegionMap = reader["regionMapTexture"].ToString(); | ||
227 | if (tempRegionMap != "") | ||
228 | { | ||
229 | retval.regionMapTextureID = new libsecondlife.LLUUID(tempRegionMap); | ||
230 | } | ||
231 | else | ||
232 | { | ||
233 | retval.regionMapTextureID = new libsecondlife.LLUUID(); | ||
234 | } | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | return null; | ||
239 | } | ||
240 | return retval; | ||
241 | } | ||
242 | |||
243 | /// <summary> | ||
244 | /// Reads an agent row from a database reader | ||
245 | /// </summary> | ||
246 | /// <param name="reader">An active database reader</param> | ||
247 | /// <returns>A user session agent</returns> | ||
248 | public UserAgentData readAgentRow(IDataReader reader) | ||
249 | { | ||
250 | UserAgentData retval = new UserAgentData(); | ||
251 | |||
252 | if (reader.Read()) | ||
253 | { | ||
254 | // Agent IDs | ||
255 | retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]); | ||
256 | retval.sessionID = new libsecondlife.LLUUID((string)reader["sessionID"]); | ||
257 | retval.secureSessionID = new libsecondlife.LLUUID((string)reader["secureSessionID"]); | ||
258 | |||
259 | // Agent Who? | ||
260 | retval.agentIP = (string)reader["agentIP"]; | ||
261 | retval.agentPort = Convert.ToUInt32(reader["agentPort"].ToString()); | ||
262 | retval.agentOnline = Convert.ToBoolean(reader["agentOnline"].ToString()); | ||
263 | |||
264 | // Login/Logout times (UNIX Epoch) | ||
265 | retval.loginTime = Convert.ToInt32(reader["loginTime"].ToString()); | ||
266 | retval.logoutTime = Convert.ToInt32(reader["logoutTime"].ToString()); | ||
267 | |||
268 | // Current position | ||
269 | retval.currentRegion = (string)reader["currentRegion"]; | ||
270 | retval.currentHandle = Convert.ToUInt64(reader["currentHandle"].ToString()); | ||
271 | libsecondlife.LLVector3.TryParse((string)reader["currentPos"], out retval.currentPos); | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | return null; | ||
276 | } | ||
277 | return retval; | ||
278 | } | ||
279 | |||
280 | /// <summary> | ||
281 | /// Reads a user profile from an active data reader | ||
282 | /// </summary> | ||
283 | /// <param name="reader">An active database reader</param> | ||
284 | /// <returns>A user profile</returns> | ||
285 | public UserProfileData readUserRow(IDataReader reader) | ||
286 | { | ||
287 | UserProfileData retval = new UserProfileData(); | ||
288 | |||
289 | if (reader.Read()) | ||
290 | { | ||
291 | retval.UUID = new libsecondlife.LLUUID((string)reader["UUID"]); | ||
292 | retval.username = (string)reader["username"]; | ||
293 | retval.surname = (string)reader["lastname"]; | ||
294 | |||
295 | retval.passwordHash = (string)reader["passwordHash"]; | ||
296 | retval.passwordSalt = (string)reader["passwordSalt"]; | ||
297 | |||
298 | retval.homeRegion = Convert.ToUInt64(reader["homeRegion"].ToString()); | ||
299 | retval.homeLocation = new libsecondlife.LLVector3( | ||
300 | Convert.ToSingle(reader["homeLocationX"].ToString()), | ||
301 | Convert.ToSingle(reader["homeLocationY"].ToString()), | ||
302 | Convert.ToSingle(reader["homeLocationZ"].ToString())); | ||
303 | retval.homeLookAt = new libsecondlife.LLVector3( | ||
304 | Convert.ToSingle(reader["homeLookAtX"].ToString()), | ||
305 | Convert.ToSingle(reader["homeLookAtY"].ToString()), | ||
306 | Convert.ToSingle(reader["homeLookAtZ"].ToString())); | ||
307 | |||
308 | retval.created = Convert.ToInt32(reader["created"].ToString()); | ||
309 | retval.lastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); | ||
310 | |||
311 | retval.userInventoryURI = (string)reader["userInventoryURI"]; | ||
312 | retval.userAssetURI = (string)reader["userAssetURI"]; | ||
313 | |||
314 | retval.profileCanDoMask = Convert.ToUInt32(reader["profileCanDoMask"].ToString()); | ||
315 | retval.profileWantDoMask = Convert.ToUInt32(reader["profileWantDoMask"].ToString()); | ||
316 | |||
317 | retval.profileAboutText = (string)reader["profileAboutText"]; | ||
318 | retval.profileFirstText = (string)reader["profileFirstText"]; | ||
319 | |||
320 | retval.profileImage = new libsecondlife.LLUUID((string)reader["profileImage"]); | ||
321 | retval.profileFirstImage = new libsecondlife.LLUUID((string)reader["profileFirstImage"]); | ||
322 | |||
323 | } | ||
324 | else | ||
325 | { | ||
326 | return null; | ||
327 | } | ||
328 | return retval; | ||
329 | } | ||
330 | |||
331 | /// <summary> | ||
332 | /// Reads a list of inventory folders returned by a query. | ||
333 | /// </summary> | ||
334 | /// <param name="reader">A MySQL Data Reader</param> | ||
335 | /// <returns>A List containing inventory folders</returns> | ||
336 | public List<InventoryFolderBase> readInventoryFolders(IDataReader reader) | ||
337 | { | ||
338 | List<InventoryFolderBase> rows = new List<InventoryFolderBase>(); | ||
339 | |||
340 | while(reader.Read()) | ||
341 | { | ||
342 | try | ||
343 | { | ||
344 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
345 | |||
346 | folder.agentID = new libsecondlife.LLUUID((string)reader["agentID"]); | ||
347 | folder.parentID = new libsecondlife.LLUUID((string)reader["parentFolderID"]); | ||
348 | folder.folderID = new libsecondlife.LLUUID((string)reader["folderID"]); | ||
349 | folder.name = (string)reader["folderName"]; | ||
350 | |||
351 | rows.Add(folder); | ||
352 | } | ||
353 | catch (Exception e) | ||
354 | { | ||
355 | Console.WriteLine(e.ToString()); | ||
356 | } | ||
357 | } | ||
358 | |||
359 | return rows; | ||
360 | } | ||
361 | |||
362 | /// <summary> | ||
363 | /// Reads a collection of items from an SQL result | ||
364 | /// </summary> | ||
365 | /// <param name="reader">The SQL Result</param> | ||
366 | /// <returns>A List containing Inventory Items</returns> | ||
367 | public List<InventoryItemBase> readInventoryItems(IDataReader reader) | ||
368 | { | ||
369 | List<InventoryItemBase> rows = new List<InventoryItemBase>(); | ||
370 | |||
371 | while (reader.Read()) | ||
372 | { | ||
373 | try | ||
374 | { | ||
375 | InventoryItemBase item = new InventoryItemBase(); | ||
376 | |||
377 | item.assetID = new libsecondlife.LLUUID((string)reader["assetID"]); | ||
378 | item.avatarID = new libsecondlife.LLUUID((string)reader["avatarID"]); | ||
379 | item.inventoryCurrentPermissions = Convert.ToUInt32(reader["inventoryCurrentPermissions"].ToString()); | ||
380 | item.inventoryDescription = (string)reader["inventoryDescription"]; | ||
381 | item.inventoryID = new libsecondlife.LLUUID((string)reader["inventoryID"]); | ||
382 | item.inventoryName = (string)reader["inventoryName"]; | ||
383 | item.inventoryNextPermissions = Convert.ToUInt32(reader["inventoryNextPermissions"].ToString()); | ||
384 | item.parentFolderID = new libsecondlife.LLUUID((string)reader["parentFolderID"]); | ||
385 | item.type = Convert.ToInt32(reader["type"].ToString()); | ||
386 | |||
387 | rows.Add(item); | ||
388 | } | ||
389 | catch (Exception e) | ||
390 | { | ||
391 | Console.WriteLine(e.ToString()); | ||
392 | } | ||
393 | } | ||
394 | |||
395 | return rows; | ||
396 | } | ||
397 | |||
398 | /// <summary> | ||
399 | /// Inserts a new row into the log database | ||
400 | /// </summary> | ||
401 | /// <param name="serverDaemon">The daemon which triggered this event</param> | ||
402 | /// <param name="target">Who were we operating on when this occured (region UUID, user UUID, etc)</param> | ||
403 | /// <param name="methodCall">The method call where the problem occured</param> | ||
404 | /// <param name="arguments">The arguments passed to the method</param> | ||
405 | /// <param name="priority">How critical is this?</param> | ||
406 | /// <param name="logMessage">Extra message info</param> | ||
407 | /// <returns>Saved successfully?</returns> | ||
408 | public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) | ||
409 | { | ||
410 | string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES "; | ||
411 | sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; | ||
412 | |||
413 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
414 | parameters["?server"] = serverDaemon; | ||
415 | parameters["?target"] = target; | ||
416 | parameters["?method"] = methodCall; | ||
417 | parameters["?arguments"] = arguments; | ||
418 | parameters["?priority"] = priority.ToString(); | ||
419 | parameters["?message"] = logMessage; | ||
420 | |||
421 | bool returnval = false; | ||
422 | |||
423 | try | ||
424 | { | ||
425 | IDbCommand result = Query(sql, parameters); | ||
426 | |||
427 | if (result.ExecuteNonQuery() == 1) | ||
428 | returnval = true; | ||
429 | |||
430 | result.Dispose(); | ||
431 | } | ||
432 | catch (Exception e) | ||
433 | { | ||
434 | Console.WriteLine(e.ToString()); | ||
435 | return false; | ||
436 | } | ||
437 | |||
438 | return returnval; | ||
439 | } | ||
440 | |||
441 | /// <summary> | ||
442 | /// Inserts a new item into the database | ||
443 | /// </summary> | ||
444 | /// <param name="item">The item</param> | ||
445 | /// <returns>Success?</returns> | ||
446 | public bool insertItem(InventoryItemBase item) | ||
447 | { | ||
448 | string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES "; | ||
449 | sql += "(?inventoryID, ?assetID, ?type, ?parentFolderID, ?avatarID, ?inventoryName, ?inventoryDescription, ?inventoryNextPermissions, ?inventoryCurrentPermissions)"; | ||
450 | |||
451 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
452 | parameters["?inventoryID"] = item.inventoryID.ToStringHyphenated(); | ||
453 | parameters["?assetID"] = item.assetID.ToStringHyphenated(); | ||
454 | parameters["?type"] = item.type.ToString(); | ||
455 | parameters["?parentFolderID"] = item.parentFolderID.ToStringHyphenated(); | ||
456 | parameters["?avatarID"] = item.avatarID.ToStringHyphenated(); | ||
457 | parameters["?inventoryName"] = item.inventoryName; | ||
458 | parameters["?inventoryDescription"] = item.inventoryDescription; | ||
459 | parameters["?inventoryNextPermissions"] = item.inventoryNextPermissions.ToString(); | ||
460 | parameters["?inventoryCurrentPermissions"] = item.inventoryCurrentPermissions.ToString(); | ||
461 | |||
462 | bool returnval = false; | ||
463 | |||
464 | try | ||
465 | { | ||
466 | IDbCommand result = Query(sql, parameters); | ||
467 | |||
468 | if (result.ExecuteNonQuery() == 1) | ||
469 | returnval = true; | ||
470 | |||
471 | result.Dispose(); | ||
472 | } | ||
473 | catch (Exception e) | ||
474 | { | ||
475 | Console.WriteLine(e.ToString()); | ||
476 | return false; | ||
477 | } | ||
478 | |||
479 | return returnval; | ||
480 | } | ||
481 | |||
482 | /// <summary> | ||
483 | /// Inserts a new folder into the database | ||
484 | /// </summary> | ||
485 | /// <param name="folder">The folder</param> | ||
486 | /// <returns>Success?</returns> | ||
487 | public bool insertFolder(InventoryFolderBase folder) | ||
488 | { | ||
489 | string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES "; | ||
490 | sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName)"; | ||
491 | |||
492 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
493 | parameters["?folderID"] = folder.folderID.ToStringHyphenated(); | ||
494 | parameters["?agentID"] = folder.agentID.ToStringHyphenated(); | ||
495 | parameters["?parentFolderID"] = folder.parentID.ToStringHyphenated(); | ||
496 | parameters["?folderName"] = folder.name; | ||
497 | |||
498 | bool returnval = false; | ||
499 | try | ||
500 | { | ||
501 | IDbCommand result = Query(sql, parameters); | ||
502 | |||
503 | if (result.ExecuteNonQuery() == 1) | ||
504 | returnval = true; | ||
505 | |||
506 | result.Dispose(); | ||
507 | } | ||
508 | catch (Exception e) | ||
509 | { | ||
510 | Console.WriteLine(e.ToString()); | ||
511 | return false; | ||
512 | } | ||
513 | return returnval; | ||
514 | } | ||
515 | |||
516 | /// <summary> | ||
517 | /// Creates a new user and inserts it into the database | ||
518 | /// </summary> | ||
519 | /// <param name="uuid">User ID</param> | ||
520 | /// <param name="username">First part of the login</param> | ||
521 | /// <param name="lastname">Second part of the login</param> | ||
522 | /// <param name="passwordHash">A salted hash of the users password</param> | ||
523 | /// <param name="passwordSalt">The salt used for the password hash</param> | ||
524 | /// <param name="homeRegion">A regionHandle of the users home region</param> | ||
525 | /// <param name="homeLocX">Home region position vector</param> | ||
526 | /// <param name="homeLocY">Home region position vector</param> | ||
527 | /// <param name="homeLocZ">Home region position vector</param> | ||
528 | /// <param name="homeLookAtX">Home region 'look at' vector</param> | ||
529 | /// <param name="homeLookAtY">Home region 'look at' vector</param> | ||
530 | /// <param name="homeLookAtZ">Home region 'look at' vector</param> | ||
531 | /// <param name="created">Account created (unix timestamp)</param> | ||
532 | /// <param name="lastlogin">Last login (unix timestamp)</param> | ||
533 | /// <param name="inventoryURI">Users inventory URI</param> | ||
534 | /// <param name="assetURI">Users asset URI</param> | ||
535 | /// <param name="canDoMask">I can do mask</param> | ||
536 | /// <param name="wantDoMask">I want to do mask</param> | ||
537 | /// <param name="aboutText">Profile text</param> | ||
538 | /// <param name="firstText">Firstlife text</param> | ||
539 | /// <param name="profileImage">UUID for profile image</param> | ||
540 | /// <param name="firstImage">UUID for firstlife image</param> | ||
541 | /// <returns>Success?</returns> | ||
542 | public bool insertUserRow(libsecondlife.LLUUID uuid, string username, string lastname, string passwordHash, string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ, | ||
543 | float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin, string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask, string aboutText, string firstText, | ||
544 | libsecondlife.LLUUID profileImage, libsecondlife.LLUUID firstImage) | ||
545 | { | ||
546 | string sql = "INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passworldSalt`, `homeRegion`, "; | ||
547 | sql += "`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, "; | ||
548 | sql += "`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, "; | ||
549 | sql += "`profileFirstText`, `profileImage`, profileFirstImage`) VALUES "; | ||
550 | |||
551 | sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passworldSalt, ?homeRegion, "; | ||
552 | sql += "?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX`, ?homeLookAtY, ?homeLookAtZ, ?created, "; | ||
553 | sql += "?lastLogin`, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, "; | ||
554 | sql += "?profileFirstText, ?profileImage, ?profileFirstImage)"; | ||
555 | |||
556 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
557 | parameters["?UUID"] = uuid.ToStringHyphenated(); | ||
558 | parameters["?username"] = username.ToString(); | ||
559 | parameters["?lastname"] = lastname.ToString(); | ||
560 | parameters["?passwordHash"] = passwordHash.ToString(); | ||
561 | parameters["?passworldSalt"] = passwordSalt.ToString(); | ||
562 | parameters["?homeRegion"] = homeRegion.ToString(); | ||
563 | parameters["?homeLocationX"] = homeLocX.ToString(); | ||
564 | parameters["?homeLocationY"] = homeLocY.ToString(); | ||
565 | parameters["?homeLocationZ"] = homeLocZ.ToString(); | ||
566 | parameters["?homeLookAtX"] = homeLookAtX.ToString(); | ||
567 | parameters["?homeLookAtY"] = homeLookAtY.ToString(); | ||
568 | parameters["?homeLookAtZ"] = homeLookAtZ.ToString(); | ||
569 | parameters["?created"] = created.ToString(); | ||
570 | parameters["?lastLogin"] = lastlogin.ToString(); | ||
571 | parameters["?userInventoryURI"] = inventoryURI.ToString(); | ||
572 | parameters["?userAssetURI"] = assetURI.ToString(); | ||
573 | parameters["?profileCanDoMask"] = canDoMask.ToString(); | ||
574 | parameters["?profileWantDoMask"] = wantDoMask.ToString(); | ||
575 | parameters["?profileAboutText"] = aboutText.ToString(); | ||
576 | parameters["?profileFirstText"] = firstText.ToString(); | ||
577 | parameters["?profileImage"] = profileImage.ToStringHyphenated(); | ||
578 | parameters["?profileFirstImage"] = firstImage.ToStringHyphenated(); | ||
579 | |||
580 | bool returnval = false; | ||
581 | |||
582 | try | ||
583 | { | ||
584 | IDbCommand result = Query(sql, parameters); | ||
585 | |||
586 | if (result.ExecuteNonQuery() == 1) | ||
587 | returnval = true; | ||
588 | |||
589 | result.Dispose(); | ||
590 | } | ||
591 | catch (Exception e) | ||
592 | { | ||
593 | Console.WriteLine(e.ToString()); | ||
594 | return false; | ||
595 | } | ||
596 | |||
597 | return returnval; | ||
598 | } | ||
599 | |||
600 | /// <summary> | ||
601 | /// Inserts a new region into the database | ||
602 | /// </summary> | ||
603 | /// <param name="profile">The region to insert</param> | ||
604 | /// <returns>Success?</returns> | ||
605 | public bool insertRegion(SimProfileData regiondata) | ||
606 | { | ||
607 | string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | ||
608 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | ||
609 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey, regionMapTexture) VALUES "; | ||
610 | |||
611 | sql += "(?regionHandle, ?regionName, ?uuid, ?regionRecvKey, ?regionSecret, ?regionSendKey, ?regionDataURI, "; | ||
612 | sql += "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; | ||
613 | sql += "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture);"; | ||
614 | |||
615 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
616 | |||
617 | parameters["?regionHandle"] = regiondata.regionHandle.ToString(); | ||
618 | parameters["?regionName"] = regiondata.regionName.ToString(); | ||
619 | parameters["?uuid"] = regiondata.UUID.ToStringHyphenated(); | ||
620 | parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString(); | ||
621 | parameters["?regionSecret"] = regiondata.regionSecret.ToString(); | ||
622 | parameters["?regionSendKey"] = regiondata.regionSendKey.ToString(); | ||
623 | parameters["?regionDataURI"] = regiondata.regionDataURI.ToString(); | ||
624 | parameters["?serverIP"] = regiondata.serverIP.ToString(); | ||
625 | parameters["?serverPort"] = regiondata.serverPort.ToString(); | ||
626 | parameters["?serverURI"] = regiondata.serverURI.ToString(); | ||
627 | parameters["?locX"] = regiondata.regionLocX.ToString(); | ||
628 | parameters["?locY"] = regiondata.regionLocY.ToString(); | ||
629 | parameters["?locZ"] = regiondata.regionLocZ.ToString(); | ||
630 | parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString(); | ||
631 | parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString(); | ||
632 | parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString(); | ||
633 | parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString(); | ||
634 | parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString(); | ||
635 | parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString(); | ||
636 | parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString(); | ||
637 | parameters["?regionUserURI"] = regiondata.regionUserURI.ToString(); | ||
638 | parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString(); | ||
639 | parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString(); | ||
640 | parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated(); | ||
641 | |||
642 | bool returnval = false; | ||
643 | |||
644 | try | ||
645 | { | ||
646 | |||
647 | IDbCommand result = Query(sql, parameters); | ||
648 | |||
649 | //Console.WriteLine(result.CommandText); | ||
650 | |||
651 | if (result.ExecuteNonQuery() == 1) | ||
652 | returnval = true; | ||
653 | |||
654 | result.Dispose(); | ||
655 | } | ||
656 | catch (Exception e) | ||
657 | { | ||
658 | Console.WriteLine(e.ToString()); | ||
659 | return false; | ||
660 | } | ||
661 | |||
662 | return returnval; | ||
663 | } | ||
664 | } | ||
665 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs deleted file mode 100644 index e988c94..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs +++ /dev/null | |||
@@ -1,271 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using OpenGrid.Framework.Data; | ||
32 | using libsecondlife; | ||
33 | |||
34 | namespace OpenGrid.Framework.Data.MySQL | ||
35 | { | ||
36 | /// <summary> | ||
37 | /// A database interface class to a user profile storage system | ||
38 | /// </summary> | ||
39 | class MySQLUserData : IUserData | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Database manager for MySQL | ||
43 | /// </summary> | ||
44 | public MySQLManager database; | ||
45 | |||
46 | /// <summary> | ||
47 | /// Loads and initialises the MySQL storage plugin | ||
48 | /// </summary> | ||
49 | public void Initialise() | ||
50 | { | ||
51 | // Load from an INI file connection details | ||
52 | // TODO: move this to XML? | ||
53 | IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini"); | ||
54 | string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname"); | ||
55 | string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database"); | ||
56 | string settingUsername = GridDataMySqlFile.ParseFileReadValue("username"); | ||
57 | string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); | ||
58 | string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); | ||
59 | string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); | ||
60 | |||
61 | database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort); | ||
62 | } | ||
63 | |||
64 | /// <summary> | ||
65 | /// Searches the database for a specified user profile | ||
66 | /// </summary> | ||
67 | /// <param name="name">The account name of the user</param> | ||
68 | /// <returns>A user profile</returns> | ||
69 | public UserProfileData getUserByName(string name) | ||
70 | { | ||
71 | return getUserByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
72 | } | ||
73 | |||
74 | /// <summary> | ||
75 | /// Searches the database for a specified user profile by name components | ||
76 | /// </summary> | ||
77 | /// <param name="user">The first part of the account name</param> | ||
78 | /// <param name="last">The second part of the account name</param> | ||
79 | /// <returns>A user profile</returns> | ||
80 | public UserProfileData getUserByName(string user, string last) | ||
81 | { | ||
82 | try | ||
83 | { | ||
84 | lock (database) | ||
85 | { | ||
86 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
87 | param["?first"] = user; | ||
88 | param["?second"] = last; | ||
89 | |||
90 | System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE username = ?first AND lastname = ?second", param); | ||
91 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
92 | |||
93 | UserProfileData row = database.readUserRow(reader); | ||
94 | |||
95 | reader.Close(); | ||
96 | result.Dispose(); | ||
97 | |||
98 | return row; | ||
99 | } | ||
100 | } | ||
101 | catch (Exception e) | ||
102 | { | ||
103 | database.Reconnect(); | ||
104 | Console.WriteLine(e.ToString()); | ||
105 | return null; | ||
106 | } | ||
107 | } | ||
108 | |||
109 | /// <summary> | ||
110 | /// Searches the database for a specified user profile by UUID | ||
111 | /// </summary> | ||
112 | /// <param name="uuid">The account ID</param> | ||
113 | /// <returns>The users profile</returns> | ||
114 | public UserProfileData getUserByUUID(LLUUID uuid) | ||
115 | { | ||
116 | try | ||
117 | { | ||
118 | lock (database) | ||
119 | { | ||
120 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
121 | param["?uuid"] = uuid.ToStringHyphenated(); | ||
122 | |||
123 | System.Data.IDbCommand result = database.Query("SELECT * FROM users WHERE UUID = ?uuid", param); | ||
124 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
125 | |||
126 | UserProfileData row = database.readUserRow(reader); | ||
127 | |||
128 | reader.Close(); | ||
129 | result.Dispose(); | ||
130 | |||
131 | return row; | ||
132 | } | ||
133 | } | ||
134 | catch (Exception e) | ||
135 | { | ||
136 | database.Reconnect(); | ||
137 | Console.WriteLine(e.ToString()); | ||
138 | return null; | ||
139 | } | ||
140 | } | ||
141 | |||
142 | /// <summary> | ||
143 | /// Returns a user session searching by name | ||
144 | /// </summary> | ||
145 | /// <param name="name">The account name</param> | ||
146 | /// <returns>The users session</returns> | ||
147 | public UserAgentData getAgentByName(string name) | ||
148 | { | ||
149 | return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]); | ||
150 | } | ||
151 | |||
152 | /// <summary> | ||
153 | /// Returns a user session by account name | ||
154 | /// </summary> | ||
155 | /// <param name="user">First part of the users account name</param> | ||
156 | /// <param name="last">Second part of the users account name</param> | ||
157 | /// <returns>The users session</returns> | ||
158 | public UserAgentData getAgentByName(string user, string last) | ||
159 | { | ||
160 | UserProfileData profile = getUserByName(user, last); | ||
161 | return getAgentByUUID(profile.UUID); | ||
162 | } | ||
163 | |||
164 | /// <summary> | ||
165 | /// Returns an agent session by account UUID | ||
166 | /// </summary> | ||
167 | /// <param name="uuid">The accounts UUID</param> | ||
168 | /// <returns>The users session</returns> | ||
169 | public UserAgentData getAgentByUUID(LLUUID uuid) | ||
170 | { | ||
171 | try | ||
172 | { | ||
173 | lock (database) | ||
174 | { | ||
175 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
176 | param["?uuid"] = uuid.ToStringHyphenated(); | ||
177 | |||
178 | System.Data.IDbCommand result = database.Query("SELECT * FROM agents WHERE UUID = ?uuid", param); | ||
179 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
180 | |||
181 | UserAgentData row = database.readAgentRow(reader); | ||
182 | |||
183 | reader.Close(); | ||
184 | result.Dispose(); | ||
185 | |||
186 | return row; | ||
187 | } | ||
188 | } | ||
189 | catch (Exception e) | ||
190 | { | ||
191 | database.Reconnect(); | ||
192 | Console.WriteLine(e.ToString()); | ||
193 | return null; | ||
194 | } | ||
195 | } | ||
196 | |||
197 | /// <summary> | ||
198 | /// Creates a new users profile | ||
199 | /// </summary> | ||
200 | /// <param name="user">The user profile to create</param> | ||
201 | public void addNewUserProfile(UserProfileData user) | ||
202 | { | ||
203 | try | ||
204 | { | ||
205 | lock (database) | ||
206 | { | ||
207 | database.insertUserRow(user.UUID, user.username, user.surname, user.passwordHash, user.passwordSalt, user.homeRegion, user.homeLocation.X, user.homeLocation.Y, user.homeLocation.Z, | ||
208 | user.homeLookAt.X, user.homeLookAt.Y, user.homeLookAt.Z, user.created, user.lastLogin, user.userInventoryURI, user.userAssetURI, user.profileCanDoMask, user.profileWantDoMask, | ||
209 | user.profileAboutText, user.profileFirstText, user.profileImage, user.profileFirstImage); | ||
210 | } | ||
211 | } | ||
212 | catch (Exception e) | ||
213 | { | ||
214 | database.Reconnect(); | ||
215 | Console.WriteLine(e.ToString()); | ||
216 | } | ||
217 | } | ||
218 | |||
219 | /// <summary> | ||
220 | /// Creates a new agent | ||
221 | /// </summary> | ||
222 | /// <param name="agent">The agent to create</param> | ||
223 | public void addNewUserAgent(UserAgentData agent) | ||
224 | { | ||
225 | // Do nothing. | ||
226 | } | ||
227 | |||
228 | /// <summary> | ||
229 | /// Performs a money transfer request between two accounts | ||
230 | /// </summary> | ||
231 | /// <param name="from">The senders account ID</param> | ||
232 | /// <param name="to">The recievers account ID</param> | ||
233 | /// <param name="amount">The amount to transfer</param> | ||
234 | /// <returns>Success?</returns> | ||
235 | public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount) | ||
236 | { | ||
237 | return false; | ||
238 | } | ||
239 | |||
240 | /// <summary> | ||
241 | /// Performs an inventory transfer request between two accounts | ||
242 | /// </summary> | ||
243 | /// <remarks>TODO: Move to inventory server</remarks> | ||
244 | /// <param name="from">The senders account ID</param> | ||
245 | /// <param name="to">The recievers account ID</param> | ||
246 | /// <param name="item">The item to transfer</param> | ||
247 | /// <returns>Success?</returns> | ||
248 | public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item) | ||
249 | { | ||
250 | return false; | ||
251 | } | ||
252 | |||
253 | /// <summary> | ||
254 | /// Database provider name | ||
255 | /// </summary> | ||
256 | /// <returns>Provider name</returns> | ||
257 | public string getName() | ||
258 | { | ||
259 | return "MySQL Userdata Interface"; | ||
260 | } | ||
261 | |||
262 | /// <summary> | ||
263 | /// Database provider version | ||
264 | /// </summary> | ||
265 | /// <returns>provider version</returns> | ||
266 | public string getVersion() | ||
267 | { | ||
268 | return "0.1"; | ||
269 | } | ||
270 | } | ||
271 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj deleted file mode 100644 index cc3aacb..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.csproj +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{0F3C3AC1-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenGrid.Framework.Data.MySQL</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data.MySQL</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="MySql.Data.dll" > | ||
66 | <HintPath>..\..\bin\MySql.Data.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System" > | ||
70 | <HintPath>System.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Data" > | ||
74 | <HintPath>System.Data.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
84 | <Name>OpenGrid.Framework.Data</Name> | ||
85 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
87 | <Private>False</Private> | ||
88 | </ProjectReference> | ||
89 | </ItemGroup> | ||
90 | <ItemGroup> | ||
91 | <Compile Include="MySQLGridData.cs"> | ||
92 | <SubType>Code</SubType> | ||
93 | </Compile> | ||
94 | <Compile Include="MySQLInventoryData.cs"> | ||
95 | <SubType>Code</SubType> | ||
96 | </Compile> | ||
97 | <Compile Include="MySQLLogData.cs"> | ||
98 | <SubType>Code</SubType> | ||
99 | </Compile> | ||
100 | <Compile Include="MySQLManager.cs"> | ||
101 | <SubType>Code</SubType> | ||
102 | </Compile> | ||
103 | <Compile Include="MySQLUserData.cs"> | ||
104 | <SubType>Code</SubType> | ||
105 | </Compile> | ||
106 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
107 | <SubType>Code</SubType> | ||
108 | </Compile> | ||
109 | </ItemGroup> | ||
110 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
111 | <PropertyGroup> | ||
112 | <PreBuildEvent> | ||
113 | </PreBuildEvent> | ||
114 | <PostBuildEvent> | ||
115 | </PostBuildEvent> | ||
116 | </PropertyGroup> | ||
117 | </Project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build b/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build deleted file mode 100644 index a5f4028..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/OpenGrid.Framework.Data.MySQL.dll.build +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenGrid.Framework.Data.MySQL" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenGrid.Framework.Data.MySQL" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="MySQLGridData.cs" /> | ||
15 | <include name="MySQLInventoryData.cs" /> | ||
16 | <include name="MySQLLogData.cs" /> | ||
17 | <include name="MySQLManager.cs" /> | ||
18 | <include name="MySQLUserData.cs" /> | ||
19 | <include name="Properties/AssemblyInfo.cs" /> | ||
20 | </sources> | ||
21 | <references basedir="${project::get-base-directory()}"> | ||
22 | <lib> | ||
23 | <include name="${project::get-base-directory()}" /> | ||
24 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
25 | </lib> | ||
26 | <include name="../../bin/libsecondlife.dll" /> | ||
27 | <include name="../../bin/MySql.Data.dll" /> | ||
28 | <include name="../../bin/OpenGrid.Framework.Data.dll" /> | ||
29 | <include name="System.dll" /> | ||
30 | <include name="System.Data.dll" /> | ||
31 | <include name="System.Xml.dll" /> | ||
32 | </references> | ||
33 | </csc> | ||
34 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
35 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
36 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
37 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
38 | <include name="*.dll"/> | ||
39 | <include name="*.exe"/> | ||
40 | </fileset> | ||
41 | </copy> | ||
42 | </target> | ||
43 | <target name="clean"> | ||
44 | <delete dir="${bin.dir}" failonerror="false" /> | ||
45 | <delete dir="${obj.dir}" failonerror="false" /> | ||
46 | </target> | ||
47 | <target name="doc" description="Creates documentation."> | ||
48 | </target> | ||
49 | </project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs deleted file mode 100644 index 0bfd1d6..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework.Data.MySQL")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Data.MySQL")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("e49826b2-dcef-41be-a5bd-596733fa3304")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj deleted file mode 100644 index 63d0bd9..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.csproj +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{1E3F341A-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenGrid.Framework.Data.SQLite</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data.SQLite</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Data" > | ||
70 | <HintPath>System.Data.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Data.SQLite.dll" > | ||
74 | <HintPath>..\..\bin\System.Data.SQLite.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | <Reference Include="System.Xml" > | ||
78 | <HintPath>System.Xml.dll</HintPath> | ||
79 | <Private>False</Private> | ||
80 | </Reference> | ||
81 | </ItemGroup> | ||
82 | <ItemGroup> | ||
83 | <ProjectReference Include="..\OpenGrid.Framework.Data\OpenGrid.Framework.Data.csproj"> | ||
84 | <Name>OpenGrid.Framework.Data</Name> | ||
85 | <Project>{62CDF671-0000-0000-0000-000000000000}</Project> | ||
86 | <Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package> | ||
87 | <Private>False</Private> | ||
88 | </ProjectReference> | ||
89 | </ItemGroup> | ||
90 | <ItemGroup> | ||
91 | <Compile Include="SQLiteGridData.cs"> | ||
92 | <SubType>Code</SubType> | ||
93 | </Compile> | ||
94 | <Compile Include="SQLiteManager.cs"> | ||
95 | <SubType>Code</SubType> | ||
96 | </Compile> | ||
97 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
98 | <SubType>Code</SubType> | ||
99 | </Compile> | ||
100 | </ItemGroup> | ||
101 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
102 | <PropertyGroup> | ||
103 | <PreBuildEvent> | ||
104 | </PreBuildEvent> | ||
105 | <PostBuildEvent> | ||
106 | </PostBuildEvent> | ||
107 | </PropertyGroup> | ||
108 | </Project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build b/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build deleted file mode 100644 index 79b0edf..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.SQLite/OpenGrid.Framework.Data.SQLite.dll.build +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenGrid.Framework.Data.SQLite" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenGrid.Framework.Data.SQLite" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="SQLiteGridData.cs" /> | ||
15 | <include name="SQLiteManager.cs" /> | ||
16 | <include name="Properties/AssemblyInfo.cs" /> | ||
17 | </sources> | ||
18 | <references basedir="${project::get-base-directory()}"> | ||
19 | <lib> | ||
20 | <include name="${project::get-base-directory()}" /> | ||
21 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
22 | </lib> | ||
23 | <include name="../../bin/libsecondlife.dll" /> | ||
24 | <include name="../../bin/OpenGrid.Framework.Data.dll" /> | ||
25 | <include name="System.dll" /> | ||
26 | <include name="System.Data.dll" /> | ||
27 | <include name="../../bin/System.Data.SQLite.dll" /> | ||
28 | <include name="System.Xml.dll" /> | ||
29 | </references> | ||
30 | </csc> | ||
31 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
32 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
33 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
34 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
35 | <include name="*.dll"/> | ||
36 | <include name="*.exe"/> | ||
37 | </fileset> | ||
38 | </copy> | ||
39 | </target> | ||
40 | <target name="clean"> | ||
41 | <delete dir="${bin.dir}" failonerror="false" /> | ||
42 | <delete dir="${obj.dir}" failonerror="false" /> | ||
43 | </target> | ||
44 | <target name="doc" description="Creates documentation."> | ||
45 | </target> | ||
46 | </project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs deleted file mode 100644 index 57c4bae..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.SQLite/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework.Data.SQLite")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Data.SQLite")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs deleted file mode 100644 index 94ed46f..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteGridData.cs +++ /dev/null | |||
@@ -1,190 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using OpenGrid.Framework.Data; | ||
32 | |||
33 | namespace OpenGrid.Framework.Data.SQLite | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// A Grid Interface to the SQLite database | ||
37 | /// </summary> | ||
38 | public class SQLiteGridData : IGridData | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A database manager | ||
42 | /// </summary> | ||
43 | private SQLiteManager database; | ||
44 | |||
45 | /// <summary> | ||
46 | /// Initialises the Grid Interface | ||
47 | /// </summary> | ||
48 | public void Initialise() | ||
49 | { | ||
50 | database = new SQLiteManager("localhost", "db", "user", "password", "false"); | ||
51 | } | ||
52 | |||
53 | /// <summary> | ||
54 | /// Shuts down the grid interface | ||
55 | /// </summary> | ||
56 | public void Close() | ||
57 | { | ||
58 | database.Close(); | ||
59 | } | ||
60 | |||
61 | /// <summary> | ||
62 | /// Returns the name of this grid interface | ||
63 | /// </summary> | ||
64 | /// <returns>A string containing the grid interface</returns> | ||
65 | public string getName() | ||
66 | { | ||
67 | return "SQLite OpenGridData"; | ||
68 | } | ||
69 | |||
70 | /// <summary> | ||
71 | /// Returns the version of this grid interface | ||
72 | /// </summary> | ||
73 | /// <returns>A string containing the version</returns> | ||
74 | public string getVersion() | ||
75 | { | ||
76 | return "0.1"; | ||
77 | } | ||
78 | |||
79 | /// <summary> | ||
80 | /// Returns a list of regions within the specified ranges | ||
81 | /// </summary> | ||
82 | /// <param name="a">minimum X coordinate</param> | ||
83 | /// <param name="b">minimum Y coordinate</param> | ||
84 | /// <param name="c">maximum X coordinate</param> | ||
85 | /// <param name="d">maximum Y coordinate</param> | ||
86 | /// <returns>An array of region profiles</returns> | ||
87 | public SimProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d) | ||
88 | { | ||
89 | return null; | ||
90 | } | ||
91 | |||
92 | /// <summary> | ||
93 | /// Returns a sim profile from it's location | ||
94 | /// </summary> | ||
95 | /// <param name="handle">Region location handle</param> | ||
96 | /// <returns>Sim profile</returns> | ||
97 | public SimProfileData GetProfileByHandle(ulong handle) | ||
98 | { | ||
99 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
100 | param["handle"] = handle.ToString(); | ||
101 | |||
102 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE handle = @handle", param); | ||
103 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
104 | |||
105 | SimProfileData row = database.getRow(reader); | ||
106 | reader.Close(); | ||
107 | result.Dispose(); | ||
108 | |||
109 | return row; | ||
110 | } | ||
111 | |||
112 | /// <summary> | ||
113 | /// Returns a sim profile from it's UUID | ||
114 | /// </summary> | ||
115 | /// <param name="uuid">The region UUID</param> | ||
116 | /// <returns>The sim profile</returns> | ||
117 | public SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID uuid) | ||
118 | { | ||
119 | Dictionary<string, string> param = new Dictionary<string, string>(); | ||
120 | param["uuid"] = uuid.ToStringHyphenated(); | ||
121 | |||
122 | System.Data.IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param); | ||
123 | System.Data.IDataReader reader = result.ExecuteReader(); | ||
124 | |||
125 | SimProfileData row = database.getRow(reader); | ||
126 | reader.Close(); | ||
127 | result.Dispose(); | ||
128 | |||
129 | return row; | ||
130 | } | ||
131 | |||
132 | /// <summary> | ||
133 | /// Adds a new specified region to the database | ||
134 | /// </summary> | ||
135 | /// <param name="profile">The profile to add</param> | ||
136 | /// <returns>A dataresponse enum indicating success</returns> | ||
137 | public DataResponse AddProfile(SimProfileData profile) | ||
138 | { | ||
139 | if (database.insertRow(profile)) | ||
140 | { | ||
141 | return DataResponse.RESPONSE_OK; | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | return DataResponse.RESPONSE_ERROR; | ||
146 | } | ||
147 | } | ||
148 | |||
149 | /// <summary> | ||
150 | /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. | ||
151 | /// </summary> | ||
152 | /// <param name="uuid">The UUID of the challenger</param> | ||
153 | /// <param name="handle">The attempted regionHandle of the challenger</param> | ||
154 | /// <param name="authkey">The secret</param> | ||
155 | /// <returns>Whether the secret and regionhandle match the database entry for UUID</returns> | ||
156 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authkey) | ||
157 | { | ||
158 | bool throwHissyFit = false; // Should be true by 1.0 | ||
159 | |||
160 | if (throwHissyFit) | ||
161 | throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential."); | ||
162 | |||
163 | SimProfileData data = GetProfileByLLUUID(uuid); | ||
164 | |||
165 | return (handle == data.regionHandle && authkey == data.regionSecret); | ||
166 | } | ||
167 | |||
168 | /// <summary> | ||
169 | /// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region | ||
170 | /// </summary> | ||
171 | /// <remarks>This requires a security audit.</remarks> | ||
172 | /// <param name="uuid"></param> | ||
173 | /// <param name="handle"></param> | ||
174 | /// <param name="authhash"></param> | ||
175 | /// <param name="challenge"></param> | ||
176 | /// <returns></returns> | ||
177 | public bool AuthenticateSim(libsecondlife.LLUUID uuid, ulong handle, string authhash, string challenge) | ||
178 | { | ||
179 | System.Security.Cryptography.SHA512Managed HashProvider = new System.Security.Cryptography.SHA512Managed(); | ||
180 | System.Text.ASCIIEncoding TextProvider = new ASCIIEncoding(); | ||
181 | |||
182 | byte[] stream = TextProvider.GetBytes(uuid.ToStringHyphenated() + ":" + handle.ToString() + ":" + challenge); | ||
183 | byte[] hash = HashProvider.ComputeHash(stream); | ||
184 | |||
185 | return false; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | |||
190 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs b/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs deleted file mode 100644 index 9689356..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data.SQLite/SQLiteManager.cs +++ /dev/null | |||
@@ -1,209 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using System.Data; | ||
32 | |||
33 | using System.Data.SQLite; | ||
34 | |||
35 | using OpenGrid.Framework.Data; | ||
36 | |||
37 | namespace OpenGrid.Framework.Data.SQLite | ||
38 | { | ||
39 | class SQLiteManager | ||
40 | { | ||
41 | IDbConnection dbcon; | ||
42 | |||
43 | /// <summary> | ||
44 | /// Initialises and creates a new SQLite connection and maintains it. | ||
45 | /// </summary> | ||
46 | /// <param name="hostname">The SQLite server being connected to</param> | ||
47 | /// <param name="database">The name of the SQLite database being used</param> | ||
48 | /// <param name="username">The username logging into the database</param> | ||
49 | /// <param name="password">The password for the user logging in</param> | ||
50 | /// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param> | ||
51 | public SQLiteManager(string hostname, string database, string username, string password, string cpooling) | ||
52 | { | ||
53 | try | ||
54 | { | ||
55 | string connectionString = "URI=file:GridServerSqlite.db;"; | ||
56 | dbcon = new SQLiteConnection(connectionString); | ||
57 | |||
58 | dbcon.Open(); | ||
59 | } | ||
60 | catch (Exception e) | ||
61 | { | ||
62 | throw new Exception("Error initialising SQLite Database: " + e.ToString()); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Shuts down the database connection | ||
68 | /// </summary> | ||
69 | public void Close() | ||
70 | { | ||
71 | dbcon.Close(); | ||
72 | dbcon = null; | ||
73 | } | ||
74 | |||
75 | /// <summary> | ||
76 | /// Runs a query with protection against SQL Injection by using parameterised input. | ||
77 | /// </summary> | ||
78 | /// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param> | ||
79 | /// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param> | ||
80 | /// <returns>A SQLite DB Command</returns> | ||
81 | public IDbCommand Query(string sql, Dictionary<string, string> parameters) | ||
82 | { | ||
83 | SQLiteCommand dbcommand = (SQLiteCommand)dbcon.CreateCommand(); | ||
84 | dbcommand.CommandText = sql; | ||
85 | foreach (KeyValuePair<string, string> param in parameters) | ||
86 | { | ||
87 | SQLiteParameter paramx = new SQLiteParameter(param.Key,param.Value); | ||
88 | dbcommand.Parameters.Add(paramx); | ||
89 | } | ||
90 | |||
91 | return (IDbCommand)dbcommand; | ||
92 | } | ||
93 | |||
94 | /// <summary> | ||
95 | /// Reads a region row from a database reader | ||
96 | /// </summary> | ||
97 | /// <param name="reader">An active database reader</param> | ||
98 | /// <returns>A region profile</returns> | ||
99 | public SimProfileData getRow(IDataReader reader) | ||
100 | { | ||
101 | SimProfileData retval = new SimProfileData(); | ||
102 | |||
103 | if (reader.Read()) | ||
104 | { | ||
105 | // Region Main | ||
106 | retval.regionHandle = (ulong)reader["regionHandle"]; | ||
107 | retval.regionName = (string)reader["regionName"]; | ||
108 | retval.UUID = new libsecondlife.LLUUID((string)reader["uuid"]); | ||
109 | |||
110 | // Secrets | ||
111 | retval.regionRecvKey = (string)reader["regionRecvKey"]; | ||
112 | retval.regionSecret = (string)reader["regionSecret"]; | ||
113 | retval.regionSendKey = (string)reader["regionSendKey"]; | ||
114 | |||
115 | // Region Server | ||
116 | retval.regionDataURI = (string)reader["regionDataURI"]; | ||
117 | retval.regionOnline = false; // Needs to be pinged before this can be set. | ||
118 | retval.serverIP = (string)reader["serverIP"]; | ||
119 | retval.serverPort = (uint)reader["serverPort"]; | ||
120 | retval.serverURI = (string)reader["serverURI"]; | ||
121 | |||
122 | // Location | ||
123 | retval.regionLocX = (uint)((int)reader["locX"]); | ||
124 | retval.regionLocY = (uint)((int)reader["locY"]); | ||
125 | retval.regionLocZ = (uint)((int)reader["locZ"]); | ||
126 | |||
127 | // Neighbours - 0 = No Override | ||
128 | retval.regionEastOverrideHandle = (ulong)reader["eastOverrideHandle"]; | ||
129 | retval.regionWestOverrideHandle = (ulong)reader["westOverrideHandle"]; | ||
130 | retval.regionSouthOverrideHandle = (ulong)reader["southOverrideHandle"]; | ||
131 | retval.regionNorthOverrideHandle = (ulong)reader["northOverrideHandle"]; | ||
132 | |||
133 | // Assets | ||
134 | retval.regionAssetURI = (string)reader["regionAssetURI"]; | ||
135 | retval.regionAssetRecvKey = (string)reader["regionAssetRecvKey"]; | ||
136 | retval.regionAssetSendKey = (string)reader["regionAssetSendKey"]; | ||
137 | |||
138 | // Userserver | ||
139 | retval.regionUserURI = (string)reader["regionUserURI"]; | ||
140 | retval.regionUserRecvKey = (string)reader["regionUserRecvKey"]; | ||
141 | retval.regionUserSendKey = (string)reader["regionUserSendKey"]; | ||
142 | } | ||
143 | else | ||
144 | { | ||
145 | throw new Exception("No rows to return"); | ||
146 | } | ||
147 | return retval; | ||
148 | } | ||
149 | |||
150 | /// <summary> | ||
151 | /// Inserts a new region into the database | ||
152 | /// </summary> | ||
153 | /// <param name="profile">The region to insert</param> | ||
154 | /// <returns>Success?</returns> | ||
155 | public bool insertRow(SimProfileData profile) | ||
156 | { | ||
157 | string sql = "REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, "; | ||
158 | sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; | ||
159 | sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES "; | ||
160 | |||
161 | sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, "; | ||
162 | sql += "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, "; | ||
163 | sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);"; | ||
164 | |||
165 | Dictionary<string, string> parameters = new Dictionary<string, string>(); | ||
166 | |||
167 | parameters["regionHandle"] = profile.regionHandle.ToString(); | ||
168 | parameters["regionName"] = profile.regionName; | ||
169 | parameters["uuid"] = profile.UUID.ToString(); | ||
170 | parameters["regionRecvKey"] = profile.regionRecvKey; | ||
171 | parameters["regionSendKey"] = profile.regionSendKey; | ||
172 | parameters["regionDataURI"] = profile.regionDataURI; | ||
173 | parameters["serverIP"] = profile.serverIP; | ||
174 | parameters["serverPort"] = profile.serverPort.ToString(); | ||
175 | parameters["serverURI"] = profile.serverURI; | ||
176 | parameters["locX"] = profile.regionLocX.ToString(); | ||
177 | parameters["locY"] = profile.regionLocY.ToString(); | ||
178 | parameters["locZ"] = profile.regionLocZ.ToString(); | ||
179 | parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString(); | ||
180 | parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString(); | ||
181 | parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString(); | ||
182 | parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString(); | ||
183 | parameters["regionAssetURI"] = profile.regionAssetURI; | ||
184 | parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey; | ||
185 | parameters["regionAssetSendKey"] = profile.regionAssetSendKey; | ||
186 | parameters["regionUserURI"] = profile.regionUserURI; | ||
187 | parameters["regionUserRecvKey"] = profile.regionUserRecvKey; | ||
188 | parameters["regionUserSendKey"] = profile.regionUserSendKey; | ||
189 | |||
190 | bool returnval = false; | ||
191 | |||
192 | try | ||
193 | { | ||
194 | IDbCommand result = Query(sql, parameters); | ||
195 | |||
196 | if (result.ExecuteNonQuery() == 1) | ||
197 | returnval = true; | ||
198 | |||
199 | result.Dispose(); | ||
200 | } | ||
201 | catch (Exception e) | ||
202 | { | ||
203 | return false; | ||
204 | } | ||
205 | |||
206 | return returnval; | ||
207 | } | ||
208 | } | ||
209 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/GridData.cs b/OpenGridServices/OpenGrid.Framework.Data/GridData.cs deleted file mode 100644 index e9fb215..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/GridData.cs +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | |||
32 | namespace OpenGrid.Framework.Data | ||
33 | { | ||
34 | public enum DataResponse | ||
35 | { | ||
36 | RESPONSE_OK, | ||
37 | RESPONSE_AUTHREQUIRED, | ||
38 | RESPONSE_INVALIDCREDENTIALS, | ||
39 | RESPONSE_ERROR | ||
40 | } | ||
41 | |||
42 | /// <summary> | ||
43 | /// A standard grid interface | ||
44 | /// </summary> | ||
45 | public interface IGridData | ||
46 | { | ||
47 | /// <summary> | ||
48 | /// Returns a sim profile from a regionHandle | ||
49 | /// </summary> | ||
50 | /// <param name="regionHandle">A 64bit Region Handle</param> | ||
51 | /// <returns>A simprofile</returns> | ||
52 | SimProfileData GetProfileByHandle(ulong regionHandle); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Returns a sim profile from a UUID | ||
56 | /// </summary> | ||
57 | /// <param name="UUID">A 128bit UUID</param> | ||
58 | /// <returns>A sim profile</returns> | ||
59 | SimProfileData GetProfileByLLUUID(libsecondlife.LLUUID UUID); | ||
60 | |||
61 | /// <summary> | ||
62 | /// Returns all profiles within the specified range | ||
63 | /// </summary> | ||
64 | /// <param name="Xmin">Minimum sim coordinate (X)</param> | ||
65 | /// <param name="Ymin">Minimum sim coordinate (Y)</param> | ||
66 | /// <param name="Xmax">Maximum sim coordinate (X)</param> | ||
67 | /// <param name="Ymin">Maximum sim coordinate (Y)</param> | ||
68 | /// <returns>An array containing all the sim profiles in the specified range</returns> | ||
69 | SimProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); | ||
70 | |||
71 | /// <summary> | ||
72 | /// Authenticates a sim by use of it's recv key. | ||
73 | /// WARNING: Insecure | ||
74 | /// </summary> | ||
75 | /// <param name="UUID">The UUID sent by the sim</param> | ||
76 | /// <param name="regionHandle">The regionhandle sent by the sim</param> | ||
77 | /// <param name="simrecvkey">The recieving key sent by the sim</param> | ||
78 | /// <returns>Whether the sim has been authenticated</returns> | ||
79 | bool AuthenticateSim(libsecondlife.LLUUID UUID, ulong regionHandle, string simrecvkey); | ||
80 | |||
81 | /// <summary> | ||
82 | /// Initialises the interface | ||
83 | /// </summary> | ||
84 | void Initialise(); | ||
85 | |||
86 | /// <summary> | ||
87 | /// Closes the interface | ||
88 | /// </summary> | ||
89 | void Close(); | ||
90 | |||
91 | /// <summary> | ||
92 | /// The plugin being loaded | ||
93 | /// </summary> | ||
94 | /// <returns>A string containing the plugin name</returns> | ||
95 | string getName(); | ||
96 | |||
97 | /// <summary> | ||
98 | /// The plugins version | ||
99 | /// </summary> | ||
100 | /// <returns>A string containing the plugin version</returns> | ||
101 | string getVersion(); | ||
102 | |||
103 | /// <summary> | ||
104 | /// Adds a new profile to the database | ||
105 | /// </summary> | ||
106 | /// <param name="profile">The profile to add</param> | ||
107 | /// <returns>RESPONSE_OK if successful, error if not.</returns> | ||
108 | DataResponse AddProfile(SimProfileData profile); | ||
109 | } | ||
110 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs b/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs deleted file mode 100644 index 2ac0bfe..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/ILogData.cs +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | |||
32 | namespace OpenGrid.Framework.Data | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// The severity of an individual log message | ||
36 | /// </summary> | ||
37 | public enum LogSeverity : int | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Critical: systems failure | ||
41 | /// </summary> | ||
42 | CRITICAL = 1, | ||
43 | /// <summary> | ||
44 | /// Major: warning prior to systems failure | ||
45 | /// </summary> | ||
46 | MAJOR = 2, | ||
47 | /// <summary> | ||
48 | /// Medium: an individual non-critical task failed | ||
49 | /// </summary> | ||
50 | MEDIUM = 3, | ||
51 | /// <summary> | ||
52 | /// Low: Informational warning | ||
53 | /// </summary> | ||
54 | LOW = 4, | ||
55 | /// <summary> | ||
56 | /// Info: Information | ||
57 | /// </summary> | ||
58 | INFO = 5, | ||
59 | /// <summary> | ||
60 | /// Verbose: Debug Information | ||
61 | /// </summary> | ||
62 | VERBOSE = 6 | ||
63 | } | ||
64 | |||
65 | /// <summary> | ||
66 | /// An interface to a LogData storage system | ||
67 | /// </summary> | ||
68 | public interface ILogData | ||
69 | { | ||
70 | void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,string logMessage); | ||
71 | /// <summary> | ||
72 | /// Initialises the interface | ||
73 | /// </summary> | ||
74 | void Initialise(); | ||
75 | |||
76 | /// <summary> | ||
77 | /// Closes the interface | ||
78 | /// </summary> | ||
79 | void Close(); | ||
80 | |||
81 | /// <summary> | ||
82 | /// The plugin being loaded | ||
83 | /// </summary> | ||
84 | /// <returns>A string containing the plugin name</returns> | ||
85 | string getName(); | ||
86 | |||
87 | /// <summary> | ||
88 | /// The plugins version | ||
89 | /// </summary> | ||
90 | /// <returns>A string containing the plugin version</returns> | ||
91 | string getVersion(); | ||
92 | } | ||
93 | |||
94 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs b/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs deleted file mode 100644 index d17afac..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/IniConfig.cs +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using System.IO; | ||
32 | using System.Text.RegularExpressions; | ||
33 | |||
34 | /* | ||
35 | Taken from public code listing at by Alex Pinsker | ||
36 | http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html | ||
37 | */ | ||
38 | |||
39 | namespace OpenGrid.Framework.Data | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// Parse settings from ini-like files | ||
43 | /// </summary> | ||
44 | public class IniFile | ||
45 | { | ||
46 | static IniFile() | ||
47 | { | ||
48 | _iniKeyValuePatternRegex = new Regex( | ||
49 | @"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]* | ||
50 | # key part (surrounding whitespace stripped) | ||
51 | \= | ||
52 | (\s)*(?<Value>([^\n^\s]+(\n){0,1}))) | ||
53 | # value part (surrounding whitespace stripped) | ||
54 | ", | ||
55 | RegexOptions.IgnorePatternWhitespace | | ||
56 | RegexOptions.Compiled | | ||
57 | RegexOptions.CultureInvariant); | ||
58 | } | ||
59 | static private Regex _iniKeyValuePatternRegex; | ||
60 | |||
61 | public IniFile(string iniFileName) | ||
62 | { | ||
63 | _iniFileName = iniFileName; | ||
64 | } | ||
65 | |||
66 | public string ParseFileReadValue(string key) | ||
67 | { | ||
68 | using (StreamReader reader = | ||
69 | new StreamReader(_iniFileName)) | ||
70 | { | ||
71 | do | ||
72 | { | ||
73 | string line = reader.ReadLine(); | ||
74 | Match match = | ||
75 | _iniKeyValuePatternRegex.Match(line); | ||
76 | if (match.Success) | ||
77 | { | ||
78 | string currentKey = | ||
79 | match.Groups["Key"].Value as string; | ||
80 | if (currentKey != null && | ||
81 | currentKey.Trim().CompareTo(key) == 0) | ||
82 | { | ||
83 | string value = | ||
84 | match.Groups["Value"].Value as string; | ||
85 | return value; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | } | ||
90 | while (reader.Peek() != -1); | ||
91 | } | ||
92 | return null; | ||
93 | } | ||
94 | |||
95 | public string IniFileName | ||
96 | { | ||
97 | get { return _iniFileName; } | ||
98 | } private string _iniFileName; | ||
99 | } | ||
100 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs deleted file mode 100644 index 12f559b..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/InventoryData.cs +++ /dev/null | |||
@@ -1,187 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenGrid.Framework.Data | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Inventory Item - contains all the properties associated with an individual inventory piece. | ||
37 | /// </summary> | ||
38 | public class InventoryItemBase | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// A UUID containing the ID for the inventory item itself | ||
42 | /// </summary> | ||
43 | public LLUUID inventoryID; | ||
44 | /// <summary> | ||
45 | /// The UUID of the associated asset on the asset server | ||
46 | /// </summary> | ||
47 | public LLUUID assetID; | ||
48 | /// <summary> | ||
49 | /// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc) | ||
50 | /// </summary> | ||
51 | public int type; | ||
52 | /// <summary> | ||
53 | /// The folder this item is contained in (NULL_KEY = Inventory Root) | ||
54 | /// </summary> | ||
55 | public LLUUID parentFolderID; | ||
56 | /// <summary> | ||
57 | /// The owner of this inventory item | ||
58 | /// </summary> | ||
59 | public LLUUID avatarID; | ||
60 | /// <summary> | ||
61 | /// The name of the inventory item (must be less than 64 characters) | ||
62 | /// </summary> | ||
63 | public string inventoryName; | ||
64 | /// <summary> | ||
65 | /// The description of the inventory item (must be less than 64 characters) | ||
66 | /// </summary> | ||
67 | public string inventoryDescription; | ||
68 | /// <summary> | ||
69 | /// A mask containing the permissions for the next owner (cannot be enforced) | ||
70 | /// </summary> | ||
71 | public uint inventoryNextPermissions; | ||
72 | /// <summary> | ||
73 | /// A mask containing permissions for the current owner (cannot be enforced) | ||
74 | /// </summary> | ||
75 | public uint inventoryCurrentPermissions; | ||
76 | } | ||
77 | |||
78 | /// <summary> | ||
79 | /// A Class for folders which contain users inventory | ||
80 | /// </summary> | ||
81 | public class InventoryFolderBase | ||
82 | { | ||
83 | /// <summary> | ||
84 | /// The name of the folder (64 characters or less) | ||
85 | /// </summary> | ||
86 | public string name; | ||
87 | /// <summary> | ||
88 | /// The agent who's inventory this is contained by | ||
89 | /// </summary> | ||
90 | public LLUUID agentID; | ||
91 | /// <summary> | ||
92 | /// The folder this folder is contained in (NULL_KEY for root) | ||
93 | /// </summary> | ||
94 | public LLUUID parentID; | ||
95 | /// <summary> | ||
96 | /// The UUID for this folder | ||
97 | /// </summary> | ||
98 | public LLUUID folderID; | ||
99 | } | ||
100 | |||
101 | /// <summary> | ||
102 | /// An interface for accessing inventory data from a storage server | ||
103 | /// </summary> | ||
104 | public interface IInventoryData | ||
105 | { | ||
106 | /// <summary> | ||
107 | /// Initialises the interface | ||
108 | /// </summary> | ||
109 | void Initialise(); | ||
110 | |||
111 | /// <summary> | ||
112 | /// Closes the interface | ||
113 | /// </summary> | ||
114 | void Close(); | ||
115 | |||
116 | /// <summary> | ||
117 | /// The plugin being loaded | ||
118 | /// </summary> | ||
119 | /// <returns>A string containing the plugin name</returns> | ||
120 | string getName(); | ||
121 | |||
122 | /// <summary> | ||
123 | /// The plugins version | ||
124 | /// </summary> | ||
125 | /// <returns>A string containing the plugin version</returns> | ||
126 | string getVersion(); | ||
127 | |||
128 | /// <summary> | ||
129 | /// Returns a list of inventory items contained within the specified folder | ||
130 | /// </summary> | ||
131 | /// <param name="folderID">The UUID of the target folder</param> | ||
132 | /// <returns>A List of InventoryItemBase items</returns> | ||
133 | List<InventoryItemBase> getInventoryInFolder(LLUUID folderID); | ||
134 | |||
135 | /// <summary> | ||
136 | /// Returns a list of folders in the users inventory root. | ||
137 | /// </summary> | ||
138 | /// <param name="user">The UUID of the user who is having inventory being returned</param> | ||
139 | /// <returns>A list of folders</returns> | ||
140 | List<InventoryFolderBase> getUserRootFolders(LLUUID user); | ||
141 | |||
142 | /// <summary> | ||
143 | /// Returns a list of inventory folders contained in the folder 'parentID' | ||
144 | /// </summary> | ||
145 | /// <param name="parentID">The folder to get subfolders for</param> | ||
146 | /// <returns>A list of inventory folders</returns> | ||
147 | List<InventoryFolderBase> getInventoryFolders(LLUUID parentID); | ||
148 | |||
149 | /// <summary> | ||
150 | /// Returns an inventory item by its UUID | ||
151 | /// </summary> | ||
152 | /// <param name="item">The UUID of the item to be returned</param> | ||
153 | /// <returns>A class containing item information</returns> | ||
154 | InventoryItemBase getInventoryItem(LLUUID item); | ||
155 | |||
156 | /// <summary> | ||
157 | /// Returns a specified inventory folder by its UUID | ||
158 | /// </summary> | ||
159 | /// <param name="folder">The UUID of the folder to be returned</param> | ||
160 | /// <returns>A class containing folder information</returns> | ||
161 | InventoryFolderBase getInventoryFolder(LLUUID folder); | ||
162 | |||
163 | /// <summary> | ||
164 | /// Creates a new inventory item based on item | ||
165 | /// </summary> | ||
166 | /// <param name="item">The item to be created</param> | ||
167 | void addInventoryItem(InventoryItemBase item); | ||
168 | |||
169 | /// <summary> | ||
170 | /// Updates an inventory item with item (updates based on ID) | ||
171 | /// </summary> | ||
172 | /// <param name="item">The updated item</param> | ||
173 | void updateInventoryItem(InventoryItemBase item); | ||
174 | |||
175 | /// <summary> | ||
176 | /// Adds a new folder specified by folder | ||
177 | /// </summary> | ||
178 | /// <param name="folder">The inventory folder</param> | ||
179 | void addInventoryFolder(InventoryFolderBase folder); | ||
180 | |||
181 | /// <summary> | ||
182 | /// Updates a folder based on its ID with folder | ||
183 | /// </summary> | ||
184 | /// <param name="folder">The inventory folder</param> | ||
185 | void updateInventoryFolder(InventoryFolderBase folder); | ||
186 | } | ||
187 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj deleted file mode 100644 index 0b53b02..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.csproj +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
2 | <PropertyGroup> | ||
3 | <ProjectType>Local</ProjectType> | ||
4 | <ProductVersion>8.0.50727</ProductVersion> | ||
5 | <SchemaVersion>2.0</SchemaVersion> | ||
6 | <ProjectGuid>{62CDF671-0000-0000-0000-000000000000}</ProjectGuid> | ||
7 | <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
8 | <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
9 | <ApplicationIcon></ApplicationIcon> | ||
10 | <AssemblyKeyContainerName> | ||
11 | </AssemblyKeyContainerName> | ||
12 | <AssemblyName>OpenGrid.Framework.Data</AssemblyName> | ||
13 | <DefaultClientScript>JScript</DefaultClientScript> | ||
14 | <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> | ||
15 | <DefaultTargetSchema>IE50</DefaultTargetSchema> | ||
16 | <DelaySign>false</DelaySign> | ||
17 | <OutputType>Library</OutputType> | ||
18 | <AppDesignerFolder></AppDesignerFolder> | ||
19 | <RootNamespace>OpenGrid.Framework.Data</RootNamespace> | ||
20 | <StartupObject></StartupObject> | ||
21 | <FileUpgradeFlags> | ||
22 | </FileUpgradeFlags> | ||
23 | </PropertyGroup> | ||
24 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
25 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
26 | <BaseAddress>285212672</BaseAddress> | ||
27 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
28 | <ConfigurationOverrideFile> | ||
29 | </ConfigurationOverrideFile> | ||
30 | <DefineConstants>TRACE;DEBUG</DefineConstants> | ||
31 | <DocumentationFile></DocumentationFile> | ||
32 | <DebugSymbols>True</DebugSymbols> | ||
33 | <FileAlignment>4096</FileAlignment> | ||
34 | <Optimize>False</Optimize> | ||
35 | <OutputPath>..\..\bin\</OutputPath> | ||
36 | <RegisterForComInterop>False</RegisterForComInterop> | ||
37 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
38 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
39 | <WarningLevel>4</WarningLevel> | ||
40 | <NoWarn></NoWarn> | ||
41 | </PropertyGroup> | ||
42 | <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
43 | <AllowUnsafeBlocks>False</AllowUnsafeBlocks> | ||
44 | <BaseAddress>285212672</BaseAddress> | ||
45 | <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> | ||
46 | <ConfigurationOverrideFile> | ||
47 | </ConfigurationOverrideFile> | ||
48 | <DefineConstants>TRACE</DefineConstants> | ||
49 | <DocumentationFile></DocumentationFile> | ||
50 | <DebugSymbols>False</DebugSymbols> | ||
51 | <FileAlignment>4096</FileAlignment> | ||
52 | <Optimize>True</Optimize> | ||
53 | <OutputPath>..\..\bin\</OutputPath> | ||
54 | <RegisterForComInterop>False</RegisterForComInterop> | ||
55 | <RemoveIntegerChecks>False</RemoveIntegerChecks> | ||
56 | <TreatWarningsAsErrors>False</TreatWarningsAsErrors> | ||
57 | <WarningLevel>4</WarningLevel> | ||
58 | <NoWarn></NoWarn> | ||
59 | </PropertyGroup> | ||
60 | <ItemGroup> | ||
61 | <Reference Include="libsecondlife.dll" > | ||
62 | <HintPath>..\..\bin\libsecondlife.dll</HintPath> | ||
63 | <Private>False</Private> | ||
64 | </Reference> | ||
65 | <Reference Include="System" > | ||
66 | <HintPath>System.dll</HintPath> | ||
67 | <Private>False</Private> | ||
68 | </Reference> | ||
69 | <Reference Include="System.Data" > | ||
70 | <HintPath>System.Data.dll</HintPath> | ||
71 | <Private>False</Private> | ||
72 | </Reference> | ||
73 | <Reference Include="System.Xml" > | ||
74 | <HintPath>System.Xml.dll</HintPath> | ||
75 | <Private>False</Private> | ||
76 | </Reference> | ||
77 | </ItemGroup> | ||
78 | <ItemGroup> | ||
79 | </ItemGroup> | ||
80 | <ItemGroup> | ||
81 | <Compile Include="GridData.cs"> | ||
82 | <SubType>Code</SubType> | ||
83 | </Compile> | ||
84 | <Compile Include="ILogData.cs"> | ||
85 | <SubType>Code</SubType> | ||
86 | </Compile> | ||
87 | <Compile Include="IniConfig.cs"> | ||
88 | <SubType>Code</SubType> | ||
89 | </Compile> | ||
90 | <Compile Include="InventoryData.cs"> | ||
91 | <SubType>Code</SubType> | ||
92 | </Compile> | ||
93 | <Compile Include="SimProfileData.cs"> | ||
94 | <SubType>Code</SubType> | ||
95 | </Compile> | ||
96 | <Compile Include="UserData.cs"> | ||
97 | <SubType>Code</SubType> | ||
98 | </Compile> | ||
99 | <Compile Include="UserProfileData.cs"> | ||
100 | <SubType>Code</SubType> | ||
101 | </Compile> | ||
102 | <Compile Include="Properties\AssemblyInfo.cs"> | ||
103 | <SubType>Code</SubType> | ||
104 | </Compile> | ||
105 | </ItemGroup> | ||
106 | <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> | ||
107 | <PropertyGroup> | ||
108 | <PreBuildEvent> | ||
109 | </PreBuildEvent> | ||
110 | <PostBuildEvent> | ||
111 | </PostBuildEvent> | ||
112 | </PropertyGroup> | ||
113 | </Project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build b/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build deleted file mode 100644 index 7abebeb..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/OpenGrid.Framework.Data.dll.build +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | <?xml version="1.0" ?> | ||
2 | <project name="OpenGrid.Framework.Data" default="build"> | ||
3 | <target name="build"> | ||
4 | <echo message="Build Directory is ${project::get-base-directory()}/${build.dir}" /> | ||
5 | <mkdir dir="${project::get-base-directory()}/${build.dir}" /> | ||
6 | <copy todir="${project::get-base-directory()}/${build.dir}"> | ||
7 | <fileset basedir="${project::get-base-directory()}"> | ||
8 | </fileset> | ||
9 | </copy> | ||
10 | <csc target="library" debug="${build.debug}" unsafe="False" define="TRACE;DEBUG" output="${project::get-base-directory()}/${build.dir}/${project::get-name()}.dll"> | ||
11 | <resources prefix="OpenGrid.Framework.Data" dynamicprefix="true" > | ||
12 | </resources> | ||
13 | <sources failonempty="true"> | ||
14 | <include name="GridData.cs" /> | ||
15 | <include name="ILogData.cs" /> | ||
16 | <include name="IniConfig.cs" /> | ||
17 | <include name="InventoryData.cs" /> | ||
18 | <include name="SimProfileData.cs" /> | ||
19 | <include name="UserData.cs" /> | ||
20 | <include name="UserProfileData.cs" /> | ||
21 | <include name="Properties/AssemblyInfo.cs" /> | ||
22 | </sources> | ||
23 | <references basedir="${project::get-base-directory()}"> | ||
24 | <lib> | ||
25 | <include name="${project::get-base-directory()}" /> | ||
26 | <include name="${project::get-base-directory()}/${build.dir}" /> | ||
27 | </lib> | ||
28 | <include name="../../bin/libsecondlife.dll" /> | ||
29 | <include name="System.dll" /> | ||
30 | <include name="System.Data.dll" /> | ||
31 | <include name="System.Xml.dll" /> | ||
32 | </references> | ||
33 | </csc> | ||
34 | <echo message="Copying from [${project::get-base-directory()}/${build.dir}/] to [${project::get-base-directory()}/../../bin/" /> | ||
35 | <mkdir dir="${project::get-base-directory()}/../../bin/"/> | ||
36 | <copy todir="${project::get-base-directory()}/../../bin/"> | ||
37 | <fileset basedir="${project::get-base-directory()}/${build.dir}/" > | ||
38 | <include name="*.dll"/> | ||
39 | <include name="*.exe"/> | ||
40 | </fileset> | ||
41 | </copy> | ||
42 | </target> | ||
43 | <target name="clean"> | ||
44 | <delete dir="${bin.dir}" failonerror="false" /> | ||
45 | <delete dir="${obj.dir}" failonerror="false" /> | ||
46 | </target> | ||
47 | <target name="doc" description="Creates documentation."> | ||
48 | </target> | ||
49 | </project> | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs b/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs deleted file mode 100644 index 1446673..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/Properties/AssemblyInfo.cs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | using System.Reflection; | ||
2 | using System.Runtime.CompilerServices; | ||
3 | using System.Runtime.InteropServices; | ||
4 | |||
5 | // General Information about an assembly is controlled through the following | ||
6 | // set of attributes. Change these attribute values to modify the information | ||
7 | // associated with an assembly. | ||
8 | [assembly: AssemblyTitle("OpenGrid.Framework.Data")] | ||
9 | [assembly: AssemblyDescription("")] | ||
10 | [assembly: AssemblyConfiguration("")] | ||
11 | [assembly: AssemblyCompany("")] | ||
12 | [assembly: AssemblyProduct("OpenGrid.Framework.Data")] | ||
13 | [assembly: AssemblyCopyright("Copyright © 2007")] | ||
14 | [assembly: AssemblyTrademark("")] | ||
15 | [assembly: AssemblyCulture("")] | ||
16 | |||
17 | // Setting ComVisible to false makes the types in this assembly not visible | ||
18 | // to COM components. If you need to access a type in this assembly from | ||
19 | // COM, set the ComVisible attribute to true on that type. | ||
20 | [assembly: ComVisible(false)] | ||
21 | |||
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM | ||
23 | [assembly: Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")] | ||
24 | |||
25 | // Version information for an assembly consists of the following four values: | ||
26 | // | ||
27 | // Major Version | ||
28 | // Minor Version | ||
29 | // Build Number | ||
30 | // Revision | ||
31 | // | ||
32 | // You can specify all the values or you can default the Revision and Build Numbers | ||
33 | // by using the '*' as shown below: | ||
34 | [assembly: AssemblyVersion("1.0.0.0")] | ||
35 | [assembly: AssemblyFileVersion("1.0.0.0")] | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs b/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs deleted file mode 100644 index a3e7cb7..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/SimProfileData.cs +++ /dev/null | |||
@@ -1,114 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | |||
32 | namespace OpenGrid.Framework.Data | ||
33 | { | ||
34 | /// <summary> | ||
35 | /// A class which contains information known to the grid server about a region | ||
36 | /// </summary> | ||
37 | public class SimProfileData | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// The name of the region | ||
41 | /// </summary> | ||
42 | public string regionName = ""; | ||
43 | |||
44 | /// <summary> | ||
45 | /// A 64-bit number combining map position into a (mostly) unique ID | ||
46 | /// </summary> | ||
47 | public ulong regionHandle; | ||
48 | |||
49 | /// <summary> | ||
50 | /// OGS/OpenSim Specific ID for a region | ||
51 | /// </summary> | ||
52 | public libsecondlife.LLUUID UUID; | ||
53 | |||
54 | /// <summary> | ||
55 | /// Coordinates of the region | ||
56 | /// </summary> | ||
57 | public uint regionLocX; | ||
58 | public uint regionLocY; | ||
59 | public uint regionLocZ; // Reserved (round-robin, layers, etc) | ||
60 | |||
61 | /// <summary> | ||
62 | /// Authentication secrets | ||
63 | /// </summary> | ||
64 | /// <remarks>Not very secure, needs improvement.</remarks> | ||
65 | public string regionSendKey = ""; | ||
66 | public string regionRecvKey = ""; | ||
67 | public string regionSecret = ""; | ||
68 | |||
69 | /// <summary> | ||
70 | /// Whether the region is online | ||
71 | /// </summary> | ||
72 | public bool regionOnline; | ||
73 | |||
74 | /// <summary> | ||
75 | /// Information about the server that the region is currently hosted on | ||
76 | /// </summary> | ||
77 | public string serverIP = ""; | ||
78 | public uint serverPort; | ||
79 | public string serverURI = ""; | ||
80 | |||
81 | /// <summary> | ||
82 | /// Set of optional overrides. Can be used to create non-eulicidean spaces. | ||
83 | /// </summary> | ||
84 | public ulong regionNorthOverrideHandle; | ||
85 | public ulong regionSouthOverrideHandle; | ||
86 | public ulong regionEastOverrideHandle; | ||
87 | public ulong regionWestOverrideHandle; | ||
88 | |||
89 | /// <summary> | ||
90 | /// Optional: URI Location of the region database | ||
91 | /// </summary> | ||
92 | /// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks> | ||
93 | public string regionDataURI = ""; | ||
94 | |||
95 | /// <summary> | ||
96 | /// Region Asset Details | ||
97 | /// </summary> | ||
98 | public string regionAssetURI = ""; | ||
99 | public string regionAssetSendKey = ""; | ||
100 | public string regionAssetRecvKey = ""; | ||
101 | |||
102 | /// <summary> | ||
103 | /// Region Userserver Details | ||
104 | /// </summary> | ||
105 | public string regionUserURI = ""; | ||
106 | public string regionUserSendKey = ""; | ||
107 | public string regionUserRecvKey = ""; | ||
108 | |||
109 | /// <summary> | ||
110 | /// Region Map Texture Asset | ||
111 | /// </summary> | ||
112 | public libsecondlife.LLUUID regionMapTextureID = new libsecondlife.LLUUID("00000000-0000-0000-9999-000000000006"); | ||
113 | } | ||
114 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/UserData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserData.cs deleted file mode 100644 index c2d5a72..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/UserData.cs +++ /dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenGrid.Framework.Data | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// An interface for connecting to user storage servers. | ||
37 | /// </summary> | ||
38 | public interface IUserData | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// Returns a user profile from a database via their UUID | ||
42 | /// </summary> | ||
43 | /// <param name="user">The accounts UUID</param> | ||
44 | /// <returns>The user data profile</returns> | ||
45 | UserProfileData getUserByUUID(LLUUID user); | ||
46 | |||
47 | /// <summary> | ||
48 | /// Returns a users profile by searching their username | ||
49 | /// </summary> | ||
50 | /// <param name="name">The users username</param> | ||
51 | /// <returns>The user data profile</returns> | ||
52 | UserProfileData getUserByName(string name); | ||
53 | |||
54 | /// <summary> | ||
55 | /// Returns a users profile by searching their username parts | ||
56 | /// </summary> | ||
57 | /// <param name="fname">Account firstname</param> | ||
58 | /// <param name="lname">Account lastname</param> | ||
59 | /// <returns>The user data profile</returns> | ||
60 | UserProfileData getUserByName(string fname, string lname); | ||
61 | |||
62 | /// <summary> | ||
63 | /// Returns the current agent for a user searching by it's UUID | ||
64 | /// </summary> | ||
65 | /// <param name="user">The users UUID</param> | ||
66 | /// <returns>The current agent session</returns> | ||
67 | UserAgentData getAgentByUUID(LLUUID user); | ||
68 | |||
69 | /// <summary> | ||
70 | /// Returns the current session agent for a user searching by username | ||
71 | /// </summary> | ||
72 | /// <param name="name">The users account name</param> | ||
73 | /// <returns>The current agent session</returns> | ||
74 | UserAgentData getAgentByName(string name); | ||
75 | |||
76 | /// <summary> | ||
77 | /// Returns the current session agent for a user searching by username parts | ||
78 | /// </summary> | ||
79 | /// <param name="fname">The users first account name</param> | ||
80 | /// <param name="lname">The users account surname</param> | ||
81 | /// <returns>The current agent session</returns> | ||
82 | UserAgentData getAgentByName(string fname, string lname); | ||
83 | |||
84 | /// <summary> | ||
85 | /// Adds a new User profile to the database | ||
86 | /// </summary> | ||
87 | /// <param name="user">UserProfile to add</param> | ||
88 | void addNewUserProfile(UserProfileData user); | ||
89 | |||
90 | /// <summary> | ||
91 | /// Adds a new agent to the database | ||
92 | /// </summary> | ||
93 | /// <param name="agent">The agent to add</param> | ||
94 | void addNewUserAgent(UserAgentData agent); | ||
95 | |||
96 | /// <summary> | ||
97 | /// Attempts to move currency units between accounts (NOT RELIABLE / TRUSTWORTHY. DONT TRY RUN YOUR OWN CURRENCY EXCHANGE WITH REAL VALUES) | ||
98 | /// </summary> | ||
99 | /// <param name="from">The account to transfer from</param> | ||
100 | /// <param name="to">The account to transfer to</param> | ||
101 | /// <param name="amount">The amount to transfer</param> | ||
102 | /// <returns>Successful?</returns> | ||
103 | bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount); | ||
104 | |||
105 | /// <summary> | ||
106 | /// Attempts to move inventory between accounts, if inventory is copyable it will be copied into the target account. | ||
107 | /// </summary> | ||
108 | /// <param name="from">User to transfer from</param> | ||
109 | /// <param name="to">User to transfer to</param> | ||
110 | /// <param name="inventory">Specified inventory item</param> | ||
111 | /// <returns>Successful?</returns> | ||
112 | bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory); | ||
113 | |||
114 | /// <summary> | ||
115 | /// Returns the plugin version | ||
116 | /// </summary> | ||
117 | /// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns> | ||
118 | string getVersion(); | ||
119 | |||
120 | /// <summary> | ||
121 | /// Returns the plugin name | ||
122 | /// </summary> | ||
123 | /// <returns>Plugin name, eg MySQL User Provider</returns> | ||
124 | string getName(); | ||
125 | |||
126 | /// <summary> | ||
127 | /// Initialises the plugin (artificial constructor) | ||
128 | /// </summary> | ||
129 | void Initialise(); | ||
130 | } | ||
131 | } | ||
diff --git a/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs b/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs deleted file mode 100644 index 82633e1..0000000 --- a/OpenGridServices/OpenGrid.Framework.Data/UserProfileData.cs +++ /dev/null | |||
@@ -1,182 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.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.Text; | ||
31 | using libsecondlife; | ||
32 | |||
33 | namespace OpenGrid.Framework.Data | ||
34 | { | ||
35 | /// <summary> | ||
36 | /// Information about a particular user known to the userserver | ||
37 | /// </summary> | ||
38 | public class UserProfileData | ||
39 | { | ||
40 | /// <summary> | ||
41 | /// The ID value for this user | ||
42 | /// </summary> | ||
43 | public LLUUID UUID; | ||
44 | |||
45 | /// <summary> | ||
46 | /// The first component of a users account name | ||
47 | /// </summary> | ||
48 | public string username; | ||
49 | /// <summary> | ||
50 | /// The second component of a users account name | ||
51 | /// </summary> | ||
52 | public string surname; | ||
53 | |||
54 | /// <summary> | ||
55 | /// A salted hash containing the users password, in the format md5(md5(password) + ":" + salt) | ||
56 | /// </summary> | ||
57 | /// <remarks>This is double MD5'd because the client sends an unsalted MD5 to the loginserver</remarks> | ||
58 | public string passwordHash; | ||
59 | /// <summary> | ||
60 | /// The salt used for the users hash, should be 32 bytes or longer | ||
61 | /// </summary> | ||
62 | public string passwordSalt; | ||
63 | |||
64 | /// <summary> | ||
65 | /// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into | ||
66 | /// </summary> | ||
67 | public ulong homeRegion; | ||
68 | /// <summary> | ||
69 | /// The coordinates inside the region of the home location | ||
70 | /// </summary> | ||
71 | public LLVector3 homeLocation; | ||
72 | /// <summary> | ||
73 | /// Where the user will be looking when they rez. | ||
74 | /// </summary> | ||
75 | public LLVector3 homeLookAt; | ||
76 | |||
77 | /// <summary> | ||
78 | /// A UNIX Timestamp (seconds since epoch) for the users creation | ||
79 | /// </summary> | ||
80 | public int created; | ||
81 | /// <summary> | ||
82 | /// A UNIX Timestamp for the users last login date / time | ||
83 | /// </summary> | ||
84 | public int lastLogin; | ||
85 | |||
86 | /// <summary> | ||
87 | /// A URI to the users inventory server, used for foreigners and large grids | ||
88 | /// </summary> | ||
89 | public string userInventoryURI; | ||
90 | /// <summary> | ||
91 | /// A URI to the users asset server, used for foreigners and large grids. | ||
92 | /// </summary> | ||
93 | public string userAssetURI; | ||
94 | |||
95 | /// <summary> | ||
96 | /// A uint mask containing the "I can do" fields of the users profile | ||
97 | /// </summary> | ||
98 | public uint profileCanDoMask; | ||
99 | /// <summary> | ||
100 | /// A uint mask containing the "I want to do" part of the users profile | ||
101 | /// </summary> | ||
102 | public uint profileWantDoMask; // Profile window "I want to" mask | ||
103 | |||
104 | /// <summary> | ||
105 | /// The about text listed in a users profile. | ||
106 | /// </summary> | ||
107 | public string profileAboutText; | ||
108 | /// <summary> | ||
109 | /// The first life about text listed in a users profile | ||
110 | /// </summary> | ||
111 | public string profileFirstText; | ||
112 | |||
113 | /// <summary> | ||
114 | /// The profile image for an avatar stored on the asset server | ||
115 | /// </summary> | ||
116 | public LLUUID profileImage; | ||
117 | /// <summary> | ||
118 | /// The profile image for the users first life tab | ||
119 | /// </summary> | ||
120 | public LLUUID profileFirstImage; | ||
121 | /// <summary> | ||
122 | /// The users last registered agent (filled in on the user server) | ||
123 | /// </summary> | ||
124 | public UserAgentData currentAgent; | ||
125 | } | ||
126 | |||
127 | /// <summary> | ||
128 | /// Information about a users session | ||
129 | /// </summary> | ||
130 | public class UserAgentData | ||
131 | { | ||
132 | /// <summary> | ||
133 | /// The UUID of the users avatar (not the agent!) | ||
134 | /// </summary> | ||
135 | public LLUUID UUID; | ||
136 | /// <summary> | ||
137 | /// The IP address of the user | ||
138 | /// </summary> | ||
139 | public string agentIP; | ||
140 | /// <summary> | ||
141 | /// The port of the user | ||
142 | /// </summary> | ||
143 | public uint agentPort; | ||
144 | /// <summary> | ||
145 | /// Is the user online? | ||
146 | /// </summary> | ||
147 | public bool agentOnline; | ||
148 | /// <summary> | ||
149 | /// The session ID for the user (also the agent ID) | ||
150 | /// </summary> | ||
151 | public LLUUID sessionID; | ||
152 | /// <summary> | ||
153 | /// The "secure" session ID for the user | ||
154 | /// </summary> | ||
155 | /// <remarks>Not very secure. Dont rely on it for anything more than Linden Lab does.</remarks> | ||
156 | public LLUUID secureSessionID; | ||
157 | /// <summary> | ||
158 | /// The region the user logged into initially | ||
159 | /// </summary> | ||
160 | public LLUUID regionID; | ||
161 | /// <summary> | ||
162 | /// A unix timestamp from when the user logged in | ||
163 | /// </summary> | ||
164 | public int loginTime; | ||
165 | /// <summary> | ||
166 | /// When this agent expired and logged out, 0 if still online | ||
167 | /// </summary> | ||
168 | public int logoutTime; | ||
169 | /// <summary> | ||
170 | /// Current region the user is logged into | ||
171 | /// </summary> | ||
172 | public LLUUID currentRegion; | ||
173 | /// <summary> | ||
174 | /// Region handle of the current region the user is in | ||
175 | /// </summary> | ||
176 | public ulong currentHandle; | ||
177 | /// <summary> | ||
178 | /// The position of the user within the region | ||
179 | /// </summary> | ||
180 | public LLVector3 currentPos; | ||
181 | } | ||
182 | } | ||