diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oGridData.cs | 17 | ||||
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oManager.cs | 21 | ||||
-rw-r--r-- | OpenSim/Framework/Data.DB4o/DB4oUserData.cs | 24 | ||||
-rw-r--r-- | OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs | 31 |
4 files changed, 50 insertions, 43 deletions
diff --git a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs index bc7225a..a96d9bd 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oGridData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oGridData.cs | |||
@@ -34,18 +34,19 @@ namespace OpenSim.Framework.Data.DB4o | |||
34 | /// <summary> | 34 | /// <summary> |
35 | /// A grid server storage mechanism employing the DB4o database system | 35 | /// A grid server storage mechanism employing the DB4o database system |
36 | /// </summary> | 36 | /// </summary> |
37 | class DB4oGridData : IGridData | 37 | internal class DB4oGridData : IGridData |
38 | { | 38 | { |
39 | /// <summary> | 39 | /// <summary> |
40 | /// The database manager object | 40 | /// The database manager object |
41 | /// </summary> | 41 | /// </summary> |
42 | DB4oGridManager manager; | 42 | private DB4oGridManager manager; |
43 | 43 | ||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Called when the plugin is first loaded (as constructors are not called) | 45 | /// Called when the plugin is first loaded (as constructors are not called) |
46 | /// </summary> | 46 | /// </summary> |
47 | public void Initialise() { | 47 | public void Initialise() |
48 | manager = new DB4oGridManager("gridserver.yap"); | 48 | { |
49 | manager = new DB4oGridManager("gridserver.yap"); | ||
49 | } | 50 | } |
50 | 51 | ||
51 | /// <summary> | 52 | /// <summary> |
@@ -93,7 +94,8 @@ namespace OpenSim.Framework.Data.DB4o | |||
93 | if (manager.simProfiles.ContainsKey(uuid)) | 94 | if (manager.simProfiles.ContainsKey(uuid)) |
94 | return manager.simProfiles[uuid]; | 95 | return manager.simProfiles[uuid]; |
95 | } | 96 | } |
96 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + "). Total Registered Regions: " + manager.simProfiles.Count); | 97 | throw new Exception("Unable to find profile with UUID (" + uuid.ToStringHyphenated() + |
98 | "). Total Registered Regions: " + manager.simProfiles.Count); | ||
97 | } | 99 | } |
98 | 100 | ||
99 | /// <summary> | 101 | /// <summary> |
@@ -123,7 +125,8 @@ namespace OpenSim.Framework.Data.DB4o | |||
123 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> | 125 | /// <param name="handle">The location the region is logging into (unused in Db4o)</param> |
124 | /// <param name="key">The shared secret</param> | 126 | /// <param name="key">The shared secret</param> |
125 | /// <returns>Authenticated?</returns> | 127 | /// <returns>Authenticated?</returns> |
126 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) { | 128 | public bool AuthenticateSim(LLUUID uuid, ulong handle, string key) |
129 | { | ||
127 | if (manager.simProfiles[uuid].regionRecvKey == key) | 130 | if (manager.simProfiles[uuid].regionRecvKey == key) |
128 | return true; | 131 | return true; |
129 | return false; | 132 | return false; |
@@ -160,4 +163,4 @@ namespace OpenSim.Framework.Data.DB4o | |||
160 | return null; | 163 | return null; |
161 | } | 164 | } |
162 | } | 165 | } |
163 | } | 166 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oManager.cs b/OpenSim/Framework/Data.DB4o/DB4oManager.cs index 9e8a03f..033413a 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oManager.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oManager.cs | |||
@@ -29,23 +29,23 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using Db4objects.Db4o; | 30 | using Db4objects.Db4o; |
31 | using libsecondlife; | 31 | using libsecondlife; |
32 | using OpenSim.Framework; | ||
33 | 32 | ||
34 | namespace OpenSim.Framework.Data.DB4o | 33 | namespace OpenSim.Framework.Data.DB4o |
35 | { | 34 | { |
36 | /// <summary> | 35 | /// <summary> |
37 | /// A Database manager for Db4o | 36 | /// A Database manager for Db4o |
38 | /// </summary> | 37 | /// </summary> |
39 | class DB4oGridManager | 38 | internal class DB4oGridManager |
40 | { | 39 | { |
41 | /// <summary> | 40 | /// <summary> |
42 | /// A list of the current regions connected (in-memory cache) | 41 | /// A list of the current regions connected (in-memory cache) |
43 | /// </summary> | 42 | /// </summary> |
44 | public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>(); | 43 | public Dictionary<LLUUID, RegionProfileData> simProfiles = new Dictionary<LLUUID, RegionProfileData>(); |
44 | |||
45 | /// <summary> | 45 | /// <summary> |
46 | /// Database File Name | 46 | /// Database File Name |
47 | /// </summary> | 47 | /// </summary> |
48 | string dbfl; | 48 | private string dbfl; |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Creates a new grid storage manager | 51 | /// Creates a new grid storage manager |
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
56 | dbfl = db4odb; | 56 | dbfl = db4odb; |
57 | IObjectContainer database; | 57 | IObjectContainer database; |
58 | database = Db4oFactory.OpenFile(dbfl); | 58 | database = Db4oFactory.OpenFile(dbfl); |
59 | IObjectSet result = database.Get(typeof(RegionProfileData)); | 59 | IObjectSet result = database.Get(typeof (RegionProfileData)); |
60 | // Loads the file into the in-memory cache | 60 | // Loads the file into the in-memory cache |
61 | foreach (RegionProfileData row in result) | 61 | foreach (RegionProfileData row in result) |
62 | { | 62 | { |
@@ -94,23 +94,22 @@ namespace OpenSim.Framework.Data.DB4o | |||
94 | return false; | 94 | return false; |
95 | } | 95 | } |
96 | } | 96 | } |
97 | |||
98 | |||
99 | } | 97 | } |
100 | 98 | ||
101 | /// <summary> | 99 | /// <summary> |
102 | /// A manager for the DB4o database (user profiles) | 100 | /// A manager for the DB4o database (user profiles) |
103 | /// </summary> | 101 | /// </summary> |
104 | class DB4oUserManager | 102 | internal class DB4oUserManager |
105 | { | 103 | { |
106 | /// <summary> | 104 | /// <summary> |
107 | /// A list of the user profiles (in memory cache) | 105 | /// A list of the user profiles (in memory cache) |
108 | /// </summary> | 106 | /// </summary> |
109 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); | 107 | public Dictionary<LLUUID, UserProfileData> userProfiles = new Dictionary<LLUUID, UserProfileData>(); |
108 | |||
110 | /// <summary> | 109 | /// <summary> |
111 | /// Database filename | 110 | /// Database filename |
112 | /// </summary> | 111 | /// </summary> |
113 | string dbfl; | 112 | private string dbfl; |
114 | 113 | ||
115 | /// <summary> | 114 | /// <summary> |
116 | /// Initialises a new DB manager | 115 | /// Initialises a new DB manager |
@@ -122,7 +121,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
122 | IObjectContainer database; | 121 | IObjectContainer database; |
123 | database = Db4oFactory.OpenFile(dbfl); | 122 | database = Db4oFactory.OpenFile(dbfl); |
124 | // Load to cache | 123 | // Load to cache |
125 | IObjectSet result = database.Get(typeof(UserProfileData)); | 124 | IObjectSet result = database.Get(typeof (UserProfileData)); |
126 | foreach (UserProfileData row in result) | 125 | foreach (UserProfileData row in result) |
127 | { | 126 | { |
128 | if (userProfiles.ContainsKey(row.UUID)) | 127 | if (userProfiles.ContainsKey(row.UUID)) |
@@ -144,7 +143,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
144 | /// <param name="record">The profile to update</param> | 143 | /// <param name="record">The profile to update</param> |
145 | /// <returns>true on success, false on fail to persist to db</returns> | 144 | /// <returns>true on success, false on fail to persist to db</returns> |
146 | public bool UpdateRecord(UserProfileData record) | 145 | public bool UpdateRecord(UserProfileData record) |
147 | { | 146 | { |
148 | if (userProfiles.ContainsKey(record.UUID)) | 147 | if (userProfiles.ContainsKey(record.UUID)) |
149 | { | 148 | { |
150 | userProfiles[record.UUID] = record; | 149 | userProfiles[record.UUID] = record; |
@@ -168,4 +167,4 @@ namespace OpenSim.Framework.Data.DB4o | |||
168 | } | 167 | } |
169 | } | 168 | } |
170 | } | 169 | } |
171 | } | 170 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs index b00fd02..c7113bf 100644 --- a/OpenSim/Framework/Data.DB4o/DB4oUserData.cs +++ b/OpenSim/Framework/Data.DB4o/DB4oUserData.cs | |||
@@ -28,8 +28,6 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.IO; | 29 | using System.IO; |
30 | using libsecondlife; | 30 | using libsecondlife; |
31 | using OpenSim.Framework; | ||
32 | using OpenSim.Framework; | ||
33 | 31 | ||
34 | namespace OpenSim.Framework.Data.DB4o | 32 | namespace OpenSim.Framework.Data.DB4o |
35 | { | 33 | { |
@@ -41,14 +39,14 @@ namespace OpenSim.Framework.Data.DB4o | |||
41 | /// <summary> | 39 | /// <summary> |
42 | /// The database manager | 40 | /// The database manager |
43 | /// </summary> | 41 | /// </summary> |
44 | DB4oUserManager manager; | 42 | private DB4oUserManager manager; |
45 | 43 | ||
46 | /// <summary> | 44 | /// <summary> |
47 | /// Artificial constructor called upon plugin load | 45 | /// Artificial constructor called upon plugin load |
48 | /// </summary> | 46 | /// </summary> |
49 | public void Initialise() | 47 | public void Initialise() |
50 | { | 48 | { |
51 | manager = new DB4oUserManager(Path.Combine(Util.dataDir(),"userprofiles.yap")); | 49 | manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap")); |
52 | } | 50 | } |
53 | 51 | ||
54 | /// <summary> | 52 | /// <summary> |
@@ -58,7 +56,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
58 | /// <returns>A user profile</returns> | 56 | /// <returns>A user profile</returns> |
59 | public UserProfileData GetUserByUUID(LLUUID uuid) | 57 | public UserProfileData GetUserByUUID(LLUUID uuid) |
60 | { | 58 | { |
61 | if(manager.userProfiles.ContainsKey(uuid)) | 59 | if (manager.userProfiles.ContainsKey(uuid)) |
62 | return manager.userProfiles[uuid]; | 60 | return manager.userProfiles[uuid]; |
63 | return null; | 61 | return null; |
64 | } | 62 | } |
@@ -95,7 +93,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
95 | /// <param name="uuid">The users account ID</param> | 93 | /// <param name="uuid">The users account ID</param> |
96 | /// <returns>A matching users profile</returns> | 94 | /// <returns>A matching users profile</returns> |
97 | public UserAgentData GetAgentByUUID(LLUUID uuid) | 95 | public UserAgentData GetAgentByUUID(LLUUID uuid) |
98 | { | 96 | { |
99 | try | 97 | try |
100 | { | 98 | { |
101 | return GetUserByUUID(uuid).currentAgent; | 99 | return GetUserByUUID(uuid).currentAgent; |
@@ -126,7 +124,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
126 | { | 124 | { |
127 | try | 125 | try |
128 | { | 126 | { |
129 | return GetUserByName(fname,lname).currentAgent; | 127 | return GetUserByName(fname, lname).currentAgent; |
130 | } | 128 | } |
131 | catch (Exception) | 129 | catch (Exception) |
132 | { | 130 | { |
@@ -149,7 +147,7 @@ namespace OpenSim.Framework.Data.DB4o | |||
149 | Console.WriteLine(e.ToString()); | 147 | Console.WriteLine(e.ToString()); |
150 | } | 148 | } |
151 | } | 149 | } |
152 | 150 | ||
153 | /// <summary> | 151 | /// <summary> |
154 | /// Creates a new user profile | 152 | /// Creates a new user profile |
155 | /// </summary> | 153 | /// </summary> |
@@ -157,15 +155,17 @@ namespace OpenSim.Framework.Data.DB4o | |||
157 | /// <returns>True on success, false on error</returns> | 155 | /// <returns>True on success, false on error</returns> |
158 | public bool UpdateUserProfile(UserProfileData user) | 156 | public bool UpdateUserProfile(UserProfileData user) |
159 | { | 157 | { |
160 | try { | 158 | try |
159 | { | ||
161 | return manager.UpdateRecord(user); | 160 | return manager.UpdateRecord(user); |
162 | } catch (Exception e) { | 161 | } |
162 | catch (Exception e) | ||
163 | { | ||
163 | Console.WriteLine(e.ToString()); | 164 | Console.WriteLine(e.ToString()); |
164 | return false; | 165 | return false; |
165 | } | 166 | } |
166 | } | 167 | } |
167 | 168 | ||
168 | |||
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// Creates a new user agent | 171 | /// Creates a new user agent |
@@ -219,4 +219,4 @@ namespace OpenSim.Framework.Data.DB4o | |||
219 | return "0.1"; | 219 | return "0.1"; |
220 | } | 220 | } |
221 | } | 221 | } |
222 | } | 222 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs index 52d09fa..6183b6e 100644 --- a/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs +++ b/OpenSim/Framework/Data.DB4o/Properties/AssemblyInfo.cs | |||
@@ -1,24 +1,28 @@ | |||
1 | using System.Reflection; | 1 | using System.Reflection; |
2 | using System.Runtime.InteropServices; | 2 | using System.Runtime.InteropServices; |
3 | |||
3 | // General Information about an assembly is controlled through the following | 4 | // General Information about an assembly is controlled through the following |
4 | // set of attributes. Change these attribute values to modify the information | 5 | // set of attributes. Change these attribute values to modify the information |
5 | // associated with an assembly. | 6 | // associated with an assembly. |
6 | [assembly: AssemblyTitle("OpenSim.Framework.Data.DB4o")] | 7 | |
7 | [assembly: AssemblyDescription("")] | 8 | [assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")] |
8 | [assembly: AssemblyConfiguration("")] | 9 | [assembly : AssemblyDescription("")] |
9 | [assembly: AssemblyCompany("")] | 10 | [assembly : AssemblyConfiguration("")] |
10 | [assembly: AssemblyProduct("OpenSim.Framework.Data.DB4o")] | 11 | [assembly : AssemblyCompany("")] |
11 | [assembly: AssemblyCopyright("Copyright © 2007")] | 12 | [assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")] |
12 | [assembly: AssemblyTrademark("")] | 13 | [assembly : AssemblyCopyright("Copyright © 2007")] |
13 | [assembly: AssemblyCulture("")] | 14 | [assembly : AssemblyTrademark("")] |
15 | [assembly : AssemblyCulture("")] | ||
14 | 16 | ||
15 | // Setting ComVisible to false makes the types in this assembly not visible | 17 | // Setting ComVisible to false makes the types in this assembly not visible |
16 | // to COM components. If you need to access a type in this assembly from | 18 | // to COM components. If you need to access a type in this assembly from |
17 | // COM, set the ComVisible attribute to true on that type. | 19 | // COM, set the ComVisible attribute to true on that type. |
18 | [assembly: ComVisible(false)] | 20 | |
21 | [assembly : ComVisible(false)] | ||
19 | 22 | ||
20 | // The following GUID is for the ID of the typelib if this project is exposed to COM | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM |
21 | [assembly: Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] | 24 | |
25 | [assembly : Guid("57991e15-79da-41b7-aa06-2e6b49165a63")] | ||
22 | 26 | ||
23 | // Version information for an assembly consists of the following four values: | 27 | // Version information for an assembly consists of the following four values: |
24 | // | 28 | // |
@@ -29,5 +33,6 @@ using System.Runtime.InteropServices; | |||
29 | // | 33 | // |
30 | // You can specify all the values or you can default the Revision and Build Numbers | 34 | // You can specify all the values or you can default the Revision and Build Numbers |
31 | // by using the '*' as shown below: | 35 | // by using the '*' as shown below: |
32 | [assembly: AssemblyVersion("1.0.0.0")] | 36 | |
33 | [assembly: AssemblyFileVersion("1.0.0.0")] | 37 | [assembly : AssemblyVersion("1.0.0.0")] |
38 | [assembly : AssemblyFileVersion("1.0.0.0")] \ No newline at end of file | ||