diff options
Diffstat (limited to 'OpenSim/Grid/InventoryServer/InventoryService.cs')
-rw-r--r-- | OpenSim/Grid/InventoryServer/InventoryService.cs | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/OpenSim/Grid/InventoryServer/InventoryService.cs b/OpenSim/Grid/InventoryServer/InventoryService.cs deleted file mode 100644 index cbc0558..0000000 --- a/OpenSim/Grid/InventoryServer/InventoryService.cs +++ /dev/null | |||
@@ -1,136 +0,0 @@ | |||
1 | using System; | ||
2 | using System.Runtime.Remoting; | ||
3 | using System.Runtime.Remoting.Channels; | ||
4 | using System.Runtime.Remoting.Channels.Tcp; | ||
5 | using System.Runtime.Serialization.Formatters; | ||
6 | using System.Collections; | ||
7 | using System.Collections.Generic; | ||
8 | |||
9 | |||
10 | using libsecondlife; | ||
11 | using OpenSim.Framework.Data; | ||
12 | using OpenSim.Framework.Communications; | ||
13 | using OpenSim.Framework.Configuration; | ||
14 | using InventoryCategory = OpenSim.Framework.Data.InventoryCategory; | ||
15 | |||
16 | namespace OpenSim.Grid.InventoryServer | ||
17 | { | ||
18 | class InventoryServiceSingleton : OpenSim.Framework.Communications.InventoryServiceBase | ||
19 | { | ||
20 | static InventoryManager _inventoryManager; | ||
21 | |||
22 | static public InventoryManager InventoryManager | ||
23 | { | ||
24 | set { _inventoryManager = value; } | ||
25 | get { return _inventoryManager; } | ||
26 | } | ||
27 | |||
28 | #region Singleton Pattern | ||
29 | static InventoryServiceSingleton instance=null; | ||
30 | |||
31 | InventoryServiceSingleton() | ||
32 | { | ||
33 | } | ||
34 | |||
35 | public static InventoryServiceSingleton Instance | ||
36 | { | ||
37 | get | ||
38 | { | ||
39 | if (instance==null) | ||
40 | { | ||
41 | instance = new InventoryServiceSingleton(); | ||
42 | } | ||
43 | return instance; | ||
44 | } | ||
45 | } | ||
46 | #endregion | ||
47 | |||
48 | #region IInventoryServices Members | ||
49 | |||
50 | public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) | ||
51 | { | ||
52 | List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); | ||
53 | InventoryFolderBase rootFolder = null; | ||
54 | |||
55 | //need to make sure we send root folder first | ||
56 | foreach (InventoryFolderBase folder in folders) | ||
57 | { | ||
58 | if (folder.parentID == libsecondlife.LLUUID.Zero) | ||
59 | { | ||
60 | rootFolder = folder; | ||
61 | folderCallBack(userID, folder); | ||
62 | } | ||
63 | } | ||
64 | |||
65 | if (rootFolder != null) | ||
66 | { | ||
67 | foreach (InventoryFolderBase folder in folders) | ||
68 | { | ||
69 | if (folder.folderID != rootFolder.folderID) | ||
70 | { | ||
71 | folderCallBack(userID, folder); | ||
72 | |||
73 | List<InventoryItemBase> items = this.RequestFolderItems(folder.folderID); | ||
74 | foreach (InventoryItemBase item in items) | ||
75 | { | ||
76 | itemCallBack(userID, item); | ||
77 | } | ||
78 | } | ||
79 | } | ||
80 | } | ||
81 | |||
82 | } | ||
83 | |||
84 | public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) | ||
85 | { | ||
86 | _inventoryManager.addInventoryFolder(folder); | ||
87 | } | ||
88 | |||
89 | public override void AddNewInventoryItem(LLUUID userID, InventoryItemBase item) | ||
90 | { | ||
91 | throw new Exception("Not implemented exception"); | ||
92 | } | ||
93 | |||
94 | public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) | ||
95 | { | ||
96 | throw new Exception("Not implemented exception"); | ||
97 | } | ||
98 | |||
99 | public List<InventoryItemBase> RequestFolderItems(LLUUID folderID) | ||
100 | { | ||
101 | return _inventoryManager.getInventoryInFolder(folderID); | ||
102 | } | ||
103 | |||
104 | |||
105 | #endregion | ||
106 | } | ||
107 | |||
108 | class InventoryService | ||
109 | { | ||
110 | InventoryServiceSingleton _inventoryServiceMethods; | ||
111 | public InventoryService(InventoryManager inventoryManager, InventoryConfig cfg) | ||
112 | { | ||
113 | // we only need to register the tcp channel once, and we don't know which other modules use remoting | ||
114 | if (ChannelServices.GetChannel("tcp") == null) | ||
115 | { | ||
116 | // Creating a custom formatter for a TcpChannel sink chain. | ||
117 | BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider(); | ||
118 | serverProvider.TypeFilterLevel = TypeFilterLevel.Full; | ||
119 | |||
120 | IDictionary props = new Hashtable(); | ||
121 | props["port"] = cfg.RemotingPort; | ||
122 | props["typeFilterLevel"] = TypeFilterLevel.Full; | ||
123 | |||
124 | // Pass the properties for the port setting and the server provider in the server chain argument. (Client remains null here.) | ||
125 | ChannelServices.RegisterChannel(new TcpChannel(props, null, serverProvider), true); | ||
126 | } | ||
127 | |||
128 | // Register the object | ||
129 | RemotingConfiguration.RegisterWellKnownServiceType(typeof(InventoryServiceSingleton), "Inventory", WellKnownObjectMode.Singleton); | ||
130 | |||
131 | _inventoryServiceMethods = InventoryServiceSingleton.Instance; | ||
132 | InventoryServiceSingleton.InventoryManager = inventoryManager; | ||
133 | } | ||
134 | |||
135 | } | ||
136 | } | ||