aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMW2007-07-11 17:47:25 +0000
committerMW2007-07-11 17:47:25 +0000
commit2ceff87a02d9862497d1d8fa965851ae2d9c9b1b (patch)
tree47cbd7a3fe7678c9ac2d56ace21ea4ebf8f628ef /OpenSim/Framework
parentupdated libsecondlife.dll to a 1.18 version (from the libsecondlife aditi bra... (diff)
downloadopensim-SC-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.zip
opensim-SC-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.gz
opensim-SC-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.bz2
opensim-SC-2ceff87a02d9862497d1d8fa965851ae2d9c9b1b.tar.xz
More work on UserProfile and inventory cache (still currently not enabled).
Asset uploading over CAPS now works, and although inventory isn't really working yet, this should now at least enables texturing of prims.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs4
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs17
-rw-r--r--OpenSim/Framework/Communications/caches/CachedUserInfo.cs77
-rw-r--r--OpenSim/Framework/Communications/caches/InventoryFolder.cs51
-rw-r--r--OpenSim/Framework/Communications/caches/UserProfileCache.cs107
-rw-r--r--OpenSim/Framework/Data/InventoryData.cs6
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs4
-rw-r--r--OpenSim/Framework/Servers/BinaryStreamHandler.cs44
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs1
9 files changed, 308 insertions, 3 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 109d027..ebc9632 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -32,6 +32,7 @@ using OpenSim.Framework.Data;
32using OpenSim.Framework.Interfaces; 32using OpenSim.Framework.Interfaces;
33using OpenSim.Framework.Types; 33using OpenSim.Framework.Types;
34using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
35using OpenSim.Framework.Communications.Caches;
35 36
36namespace OpenSim.Framework.Communications 37namespace OpenSim.Framework.Communications
37{ 38{
@@ -40,12 +41,15 @@ namespace OpenSim.Framework.Communications
40 { 41 {
41 public IUserServices UserServer; 42 public IUserServices UserServer;
42 public IGridServices GridServer; 43 public IGridServices GridServer;
44 public IInventoryServices InventoryServer;
43 public IInterRegionCommunications InterRegion; 45 public IInterRegionCommunications InterRegion;
46 public UserProfileCache UserProfilesCache;
44 47
45 public NetworkServersInfo ServersInfo; 48 public NetworkServersInfo ServersInfo;
46 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer) 49 public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer)
47 { 50 {
48 ServersInfo = serversInfo; 51 ServersInfo = serversInfo;
52 UserProfilesCache = new UserProfileCache(this);
49 } 53 }
50 54
51 #region Packet Handlers 55 #region Packet Handlers
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
new file mode 100644
index 0000000..0b05834
--- /dev/null
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -0,0 +1,17 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Data;
5using libsecondlife;
6using OpenSim.Framework.Communications.Caches;
7
8namespace OpenSim.Framework.Communications
9{
10 public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo);
11 public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
12
13 public interface IInventoryServices
14 {
15 void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
16 }
17}
diff --git a/OpenSim/Framework/Communications/caches/CachedUserInfo.cs b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs
new file mode 100644
index 0000000..1c779e9
--- /dev/null
+++ b/OpenSim/Framework/Communications/caches/CachedUserInfo.cs
@@ -0,0 +1,77 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using OpenSim.Framework.Data;
5using libsecondlife;
6
7namespace OpenSim.Framework.Communications.Caches
8{
9 public class CachedUserInfo
10 {
11 public UserProfileData UserProfile;
12 //public Dictionary<LLUUID, InventoryFolder> Folders = new Dictionary<LLUUID, InventoryFolder>();
13 public InventoryFolder RootFolder;
14
15 public CachedUserInfo()
16 {
17
18 }
19
20 /// <summary>
21 ///
22 /// </summary>
23 /// <param name="userID"></param>
24 /// <param name="folderInfo"></param>
25 public void FolderReceive(LLUUID userID, InventoryFolder folderInfo)
26 {
27 if (userID == UserProfile.UUID)
28 {
29 if (this.RootFolder == null)
30 {
31 if (folderInfo.parentID == LLUUID.Zero)
32 {
33 this.RootFolder = folderInfo;
34 }
35 }
36 else
37 {
38 if (this.RootFolder.folderID == folderInfo.parentID)
39 {
40 this.RootFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
41 }
42 else
43 {
44 InventoryFolder pFolder = this.RootFolder.HasSubFolder(folderInfo.parentID);
45 if (pFolder != null)
46 {
47 pFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
48 }
49 }
50 }
51 }
52 }
53
54 public void ItemReceive(LLUUID userID, InventoryItemBase itemInfo)
55 {
56 if (userID == UserProfile.UUID)
57 {
58 if (this.RootFolder != null)
59 {
60 if (itemInfo.parentFolderID == this.RootFolder.folderID)
61 {
62 this.RootFolder.Items.Add(itemInfo.inventoryID, itemInfo);
63 }
64 else
65 {
66 InventoryFolder pFolder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID);
67 if (pFolder != null)
68 {
69 pFolder.Items.Add(itemInfo.inventoryID, itemInfo);
70 }
71 }
72 }
73
74 }
75 }
76 }
77}
diff --git a/OpenSim/Framework/Communications/caches/InventoryFolder.cs b/OpenSim/Framework/Communications/caches/InventoryFolder.cs
new file mode 100644
index 0000000..eaddf19
--- /dev/null
+++ b/OpenSim/Framework/Communications/caches/InventoryFolder.cs
@@ -0,0 +1,51 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Data;
6
7namespace OpenSim.Framework.Communications.Caches
8{
9 public class InventoryFolder : InventoryFolderBase
10 {
11 public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>();
12 public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
13
14 public InventoryFolder()
15 {
16 }
17
18 public InventoryFolder HasSubFolder(LLUUID folderID)
19 {
20 InventoryFolder returnFolder = null;
21 if (this.SubFolders.ContainsKey(folderID))
22 {
23 returnFolder = this.SubFolders[folderID];
24 }
25 else
26 {
27 foreach (InventoryFolder folder in this.SubFolders.Values)
28 {
29 returnFolder = folder.HasSubFolder(folderID);
30 if (returnFolder != null)
31 {
32 break;
33 }
34 }
35 }
36 return returnFolder;
37 }
38
39 public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
40 {
41 InventoryFolder subFold = new InventoryFolder();
42 subFold.name = folderName;
43 subFold.folderID = folderID;
44 subFold.type = type;
45 subFold.parentID = this.folderID;
46 subFold.agentID = this.agentID;
47 this.SubFolders.Add(subFold.folderID, subFold);
48 return subFold;
49 }
50 }
51}
diff --git a/OpenSim/Framework/Communications/caches/UserProfileCache.cs b/OpenSim/Framework/Communications/caches/UserProfileCache.cs
new file mode 100644
index 0000000..0ee63ba
--- /dev/null
+++ b/OpenSim/Framework/Communications/caches/UserProfileCache.cs
@@ -0,0 +1,107 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5using OpenSim.Framework.Data;
6using OpenSim.Framework.Communications;
7
8namespace OpenSim.Framework.Communications.Caches
9{
10 public class UserProfileCache
11 {
12 public Dictionary<LLUUID, CachedUserInfo> UserProfiles = new Dictionary<LLUUID, CachedUserInfo>();
13
14 private CommunicationsManager m_parent;
15
16 public UserProfileCache(CommunicationsManager parent)
17 {
18 m_parent = parent;
19 }
20
21 /// <summary>
22 /// A new user has moved into a region in this instance
23 /// so get info from servers
24 /// </summary>
25 /// <param name="userID"></param>
26 public void AddNewUser(LLUUID userID)
27 {
28 if (!this.UserProfiles.ContainsKey(userID))
29 {
30 CachedUserInfo userInfo = new CachedUserInfo();
31 userInfo.UserProfile = this.RequestUserProfileForUser(userID);
32 this.m_parent.InventoryServer.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
33 if (userInfo.UserProfile != null)
34 {
35 this.UserProfiles.Add(userID, userInfo);
36 }
37 else
38 {
39 //no profile for this user, what do we do now?
40 }
41 }
42 else
43 {
44 //already have a cached profile for this user
45 //we should make sure its upto date with the user server version
46 }
47 }
48
49 /// <summary>
50 /// A new user has moved into a region in this instance
51 /// so get info from servers
52 /// </summary>
53 /// <param name="firstName"></param>
54 /// <param name="lastName"></param>
55 public void AddNewUser(string firstName, string lastName)
56 {
57
58 }
59
60 /// <summary>
61 /// A user has left this instance
62 /// so make sure servers have been updated
63 /// Then remove cached info
64 /// </summary>
65 /// <param name="userID"></param>
66 public void UserLogOut(LLUUID userID)
67 {
68
69 }
70
71 /// <summary>
72 /// Request the user profile from User server
73 /// </summary>
74 /// <param name="userID"></param>
75 private UserProfileData RequestUserProfileForUser(LLUUID userID)
76 {
77 return this.m_parent.UserServer.GetUserProfile(userID);
78 }
79
80 /// <summary>
81 /// Request Iventory Info from Inventory server
82 /// </summary>
83 /// <param name="userID"></param>
84 private void RequestInventoryForUser(LLUUID userID)
85 {
86
87 }
88
89 /// <summary>
90 /// Make sure UserProfile is updated on user server
91 /// </summary>
92 /// <param name="userID"></param>
93 private void UpdateUserProfileToServer(LLUUID userID)
94 {
95
96 }
97
98 /// <summary>
99 /// Update Inventory data to Inventory server
100 /// </summary>
101 /// <param name="userID"></param>
102 private void UpdateInventoryToServer(LLUUID userID)
103 {
104
105 }
106 }
107}
diff --git a/OpenSim/Framework/Data/InventoryData.cs b/OpenSim/Framework/Data/InventoryData.cs
index fe2e25c..7253cc7 100644
--- a/OpenSim/Framework/Data/InventoryData.cs
+++ b/OpenSim/Framework/Data/InventoryData.cs
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Data
48 /// </summary> 48 /// </summary>
49 public int type; 49 public int type;
50 /// <summary> 50 /// <summary>
51 /// The folder this item is contained in (NULL_KEY = Inventory Root) 51 /// The folder this item is contained in
52 /// </summary> 52 /// </summary>
53 public LLUUID parentFolderID; 53 public LLUUID parentFolderID;
54 /// <summary> 54 /// <summary>
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Data
56 /// </summary> 56 /// </summary>
57 public LLUUID avatarID; 57 public LLUUID avatarID;
58 /// <summary> 58 /// <summary>
59 /// The creator of this folder 59 /// The creator of this item
60 /// </summary> 60 /// </summary>
61 public LLUUID creatorsID; 61 public LLUUID creatorsID;
62 /// <summary> 62 /// <summary>
@@ -91,7 +91,7 @@ namespace OpenSim.Framework.Data
91 /// </summary> 91 /// </summary>
92 public LLUUID agentID; 92 public LLUUID agentID;
93 /// <summary> 93 /// <summary>
94 /// The folder this folder is contained in (NULL_KEY for root) 94 /// The folder this folder is contained in
95 /// </summary> 95 /// </summary>
96 public LLUUID parentID; 96 public LLUUID parentID;
97 /// <summary> 97 /// <summary>
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index 1b0c682..fe1e9dc 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -30,6 +30,7 @@ using System.Net;
30using libsecondlife; 30using libsecondlife;
31using libsecondlife.Packets; 31using libsecondlife.Packets;
32using OpenSim.Framework.Types; 32using OpenSim.Framework.Types;
33using OpenSim.Framework.Data;
33 34
34namespace OpenSim.Framework.Interfaces 35namespace OpenSim.Framework.Interfaces
35{ 36{
@@ -176,5 +177,8 @@ namespace OpenSim.Framework.Interfaces
176 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); 177 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLQuaternion rotation, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID);
177 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID); 178 void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, LLVector3 pos, LLUUID textureID, uint flags, LLUUID objectID, LLUUID ownerID, string text, uint parentID);
178 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation); 179 void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation);
180
181 void SendInventoryFolderDetails(LLUUID ownerID, LLUUID folderID, List<InventoryItemBase> items);
182 void SendInventoryItemDetails(LLUUID ownerID, LLUUID folderID, InventoryItemBase item);
179 } 183 }
180} 184}
diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs
new file mode 100644
index 0000000..302dbff
--- /dev/null
+++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs
@@ -0,0 +1,44 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.IO;
5
6namespace OpenSim.Framework.Servers
7{
8
9 public class BinaryStreamHandler : BaseStreamHandler
10 {
11 BinaryMethod m_restMethod;
12
13 override public byte[] Handle(string path, Stream request)
14 {
15 byte[] data = ReadFully(request);
16 string param = GetParam(path);
17 string responseString = m_restMethod(data, path, param);
18
19 return Encoding.UTF8.GetBytes(responseString);
20 }
21
22 public BinaryStreamHandler(string httpMethod, string path, BinaryMethod restMethod)
23 : base(httpMethod, path)
24 {
25 m_restMethod = restMethod;
26 }
27
28 public byte[] ReadFully(Stream stream)
29 {
30 byte[] buffer = new byte[32768];
31 using (MemoryStream ms = new MemoryStream())
32 {
33 while (true)
34 {
35 int read = stream.Read(buffer, 0, buffer.Length);
36 if (read <= 0)
37 return ms.ToArray();
38 ms.Write(buffer, 0, read);
39 }
40 }
41 }
42 }
43
44}
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs
index c6cb230..2a92fc1 100644
--- a/OpenSim/Framework/Servers/RestMethod.cs
+++ b/OpenSim/Framework/Servers/RestMethod.cs
@@ -28,4 +28,5 @@
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{
30 public delegate string RestMethod( string request, string path, string param ); 30 public delegate string RestMethod( string request, string path, string param );
31 public delegate string BinaryMethod(byte[] data, string path, string param);
31} 32}