diff options
author | Tleiades Hax | 2007-10-30 22:42:34 +0000 |
---|---|---|
committer | Tleiades Hax | 2007-10-30 22:42:34 +0000 |
commit | 6a8d8f54e88a21e6cfd78dc7981cdeec2f18094d (patch) | |
tree | 035f881d61f4a876ebdc72672e3c50a620ae4cfd | |
parent | * doh II (diff) | |
download | opensim-SC_OLD-6a8d8f54e88a21e6cfd78dc7981cdeec2f18094d.zip opensim-SC_OLD-6a8d8f54e88a21e6cfd78dc7981cdeec2f18094d.tar.gz opensim-SC_OLD-6a8d8f54e88a21e6cfd78dc7981cdeec2f18094d.tar.bz2 opensim-SC_OLD-6a8d8f54e88a21e6cfd78dc7981cdeec2f18094d.tar.xz |
Step one on the long march towards grid based inventory. Introduction of an InevntoryServer
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/General/InventoryConfig.cs | 67 | ||||
-rw-r--r-- | OpenSim/Framework/General/InventoryItemBase.cs | 30 | ||||
-rw-r--r-- | OpenSim/Framework/General/NetworkServersInfo.cs | 6 | ||||
-rw-r--r-- | OpenSim/Grid/InventoryServer/InventoryManager.cs | 170 | ||||
-rw-r--r-- | OpenSim/Grid/InventoryServer/Main.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSimMain.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/ChatModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/WorldCommModule.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 2 | ||||
-rw-r--r-- | bin/Inventory_Default.xml | 62 | ||||
-rw-r--r-- | bin/Inventory_Library.xml | 144 | ||||
-rw-r--r-- | prebuild.xml | 29 |
15 files changed, 531 insertions, 71 deletions
diff --git a/OpenSim/Framework/General/InventoryConfig.cs b/OpenSim/Framework/General/InventoryConfig.cs new file mode 100644 index 0000000..9ba3e07 --- /dev/null +++ b/OpenSim/Framework/General/InventoryConfig.cs | |||
@@ -0,0 +1,67 @@ | |||
1 | using System; | ||
2 | using System.Collections.Generic; | ||
3 | using System.Text; | ||
4 | |||
5 | namespace OpenSim.Framework | ||
6 | { | ||
7 | /// <summary> | ||
8 | /// UserConfig -- For User Server Configuration | ||
9 | /// </summary> | ||
10 | public class InventoryConfig | ||
11 | { | ||
12 | public string DefaultStartupMsg = ""; | ||
13 | public string UserServerURL = ""; | ||
14 | public string UserSendKey = ""; | ||
15 | public string UserRecvKey = ""; | ||
16 | |||
17 | public string DatabaseProvider = ""; | ||
18 | public static uint DefaultHttpPort = 8004; | ||
19 | |||
20 | public int HttpPort = 8004; | ||
21 | |||
22 | private ConfigurationMember configMember; | ||
23 | |||
24 | public InventoryConfig(string description, string filename) | ||
25 | { | ||
26 | configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); | ||
27 | configMember.performConfigurationRetrieve(); | ||
28 | } | ||
29 | |||
30 | public void loadConfigurationOptions() | ||
31 | { | ||
32 | configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); | ||
33 | configMember.addConfigurationOption("default_user_server", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default User Server URI", "http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString(), false); | ||
34 | configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to send to user server", "null", false); | ||
35 | configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "Key to expect from user server", "null", false); | ||
36 | configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); | ||
37 | configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Http Listener port", DefaultHttpPort.ToString(), false); | ||
38 | } | ||
39 | |||
40 | public bool handleIncomingConfiguration(string configuration_key, object configuration_result) | ||
41 | { | ||
42 | switch (configuration_key) | ||
43 | { | ||
44 | case "default_startup_message": | ||
45 | this.DefaultStartupMsg = (string)configuration_result; | ||
46 | break; | ||
47 | case "default_user_server": | ||
48 | this.UserServerURL = (string)configuration_result; | ||
49 | break; | ||
50 | case "user_send_key": | ||
51 | this.UserSendKey = (string)configuration_result; | ||
52 | break; | ||
53 | case "user_recv_key": | ||
54 | this.UserRecvKey = (string)configuration_result; | ||
55 | break; | ||
56 | case "database_provider": | ||
57 | this.DatabaseProvider = (string)configuration_result; | ||
58 | break; | ||
59 | case "http_port": | ||
60 | HttpPort = (int)configuration_result; | ||
61 | break; | ||
62 | } | ||
63 | |||
64 | return true; | ||
65 | } | ||
66 | } | ||
67 | } | ||
diff --git a/OpenSim/Framework/General/InventoryItemBase.cs b/OpenSim/Framework/General/InventoryItemBase.cs index 45700ae..f782913 100644 --- a/OpenSim/Framework/General/InventoryItemBase.cs +++ b/OpenSim/Framework/General/InventoryItemBase.cs | |||
@@ -25,6 +25,9 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | ||
29 | using System.Xml.Serialization; | ||
30 | using System.Collections; | ||
28 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
29 | using libsecondlife; | 32 | using libsecondlife; |
30 | 33 | ||
@@ -242,4 +245,29 @@ namespace OpenSim.Framework | |||
242 | /// <param name="folder">The id of the folder</param> | 245 | /// <param name="folder">The id of the folder</param> |
243 | void deleteInventoryFolder(LLUUID folder); | 246 | void deleteInventoryFolder(LLUUID folder); |
244 | } | 247 | } |
245 | } \ No newline at end of file | 248 | |
249 | /* | ||
250 | * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder | ||
251 | * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize | ||
252 | * into this simpler class, and then use that. | ||
253 | */ | ||
254 | [XmlRoot(ElementName = "inventory", IsNullable = true)] | ||
255 | public class SerializableInventory | ||
256 | { | ||
257 | [XmlRoot(ElementName = "folder", IsNullable = true)] | ||
258 | public class SerializableFolder : InventoryFolderBase | ||
259 | { | ||
260 | [XmlArray(ElementName = "folders", IsNullable = true)] | ||
261 | [XmlArrayItem(ElementName = "folder", IsNullable = true, Type = typeof(SerializableFolder))] | ||
262 | public ArrayList SubFolders; | ||
263 | |||
264 | [XmlArray(ElementName = "items", IsNullable = true)] | ||
265 | [XmlArrayItem(ElementName = "item", IsNullable = true, Type = typeof(InventoryItemBase))] | ||
266 | public ArrayList Items; | ||
267 | } | ||
268 | |||
269 | [XmlElement(ElementName = "folder", IsNullable = true)] | ||
270 | public SerializableFolder root; | ||
271 | } | ||
272 | |||
273 | } | ||
diff --git a/OpenSim/Framework/General/NetworkServersInfo.cs b/OpenSim/Framework/General/NetworkServersInfo.cs index 98d489e..aa8aa2b 100644 --- a/OpenSim/Framework/General/NetworkServersInfo.cs +++ b/OpenSim/Framework/General/NetworkServersInfo.cs | |||
@@ -43,6 +43,8 @@ namespace OpenSim.Framework | |||
43 | public string UserRecvKey = ""; | 43 | public string UserRecvKey = ""; |
44 | public bool isSandbox; | 44 | public bool isSandbox; |
45 | 45 | ||
46 | public string InventoryURL = ""; | ||
47 | |||
46 | public static int DefaultHttpListenerPort = 9000; | 48 | public static int DefaultHttpListenerPort = 9000; |
47 | public int HttpListenerPort = DefaultHttpListenerPort; | 49 | public int HttpListenerPort = DefaultHttpListenerPort; |
48 | 50 | ||
@@ -91,6 +93,8 @@ namespace OpenSim.Framework | |||
91 | UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); | 93 | UserSendKey = config.Configs["Network"].GetString("user_send_key", "null"); |
92 | UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); | 94 | UserRecvKey = config.Configs["Network"].GetString("user_recv_key", "null"); |
93 | AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); | 95 | AssetURL = config.Configs["Network"].GetString("asset_server_url", AssetURL); |
96 | InventoryURL = config.Configs["Network"].GetString("inventory_server_url", | ||
97 | "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString()); | ||
94 | } | 98 | } |
95 | } | 99 | } |
96 | } \ No newline at end of file | 100 | } |
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs index 016b8bb..ca9ebf4 100644 --- a/OpenSim/Grid/InventoryServer/InventoryManager.cs +++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs | |||
@@ -26,37 +26,36 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.IO; |
30 | using System.Collections.Generic; | ||
31 | using System.Text; | 30 | using System.Text; |
32 | using OpenGrid.Framework.Data; | ||
33 | using libsecondlife; | ||
34 | using System.Reflection; | 31 | using System.Reflection; |
35 | 32 | using System.Collections; | |
33 | using System.Collections.Generic; | ||
36 | using System.Xml; | 34 | using System.Xml; |
37 | using Nwc.XmlRpc; | 35 | using System.Xml.Serialization; |
38 | using OpenSim.Framework.Sims; | 36 | using libsecondlife; |
39 | using OpenSim.Framework.Inventory; | ||
40 | using OpenSim.Framework.Utilities; | ||
41 | 37 | ||
42 | using System.Security.Cryptography; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Framework.Console; | ||
40 | using OpenSim.Framework.Servers; | ||
43 | 41 | ||
44 | namespace OpenGridServices.InventoryServer | 42 | namespace OpenSim.Grid.InventoryServer |
45 | { | 43 | { |
46 | class InventoryManager | 44 | |
45 | public class InventoryManager | ||
47 | { | 46 | { |
48 | Dictionary<string, IInventoryData> _plugins = new Dictionary<string, IInventoryData>(); | 47 | IInventoryData _databasePlugin; |
49 | 48 | ||
50 | /// <summary> | 49 | /// <summary> |
51 | /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. | 50 | /// Adds a new inventory server plugin - user servers will be requested in the order they were loaded. |
52 | /// </summary> | 51 | /// </summary> |
53 | /// <param name="FileName">The filename to the inventory server plugin DLL</param> | 52 | /// <param name="FileName">The filename to the inventory server plugin DLL</param> |
54 | public void AddPlugin(string FileName) | 53 | public void AddDatabasePlugin(string FileName) |
55 | { | 54 | { |
56 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Attempting to load " + FileName); | 55 | MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName); |
57 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | 56 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); |
58 | 57 | ||
59 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); | 58 | MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); |
60 | foreach (Type pluginType in pluginAssembly.GetTypes()) | 59 | foreach (Type pluginType in pluginAssembly.GetTypes()) |
61 | { | 60 | { |
62 | if (!pluginType.IsAbstract) | 61 | if (!pluginType.IsAbstract) |
@@ -67,8 +66,9 @@ namespace OpenGridServices.InventoryServer | |||
67 | { | 66 | { |
68 | IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | 67 | IInventoryData plug = (IInventoryData)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); |
69 | plug.Initialise(); | 68 | plug.Initialise(); |
70 | this._plugins.Add(plug.getName(), plug); | 69 | _databasePlugin = plug; |
71 | OpenSim.Framework.Console.MainConsole.Instance.Verbose( "Invenstorage: Added IUserData Interface"); | 70 | MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Added IInventoryData Interface"); |
71 | break; | ||
72 | } | 72 | } |
73 | 73 | ||
74 | typeInterface = null; | 74 | typeInterface = null; |
@@ -78,48 +78,132 @@ namespace OpenGridServices.InventoryServer | |||
78 | pluginAssembly = null; | 78 | pluginAssembly = null; |
79 | } | 79 | } |
80 | 80 | ||
81 | public List<InventoryFolderBase> getRootFolders(LLUUID user) | 81 | protected static SerializableInventory loadInventoryFromXmlFile(string fileName) |
82 | { | ||
83 | FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); | ||
84 | XmlReader reader = new XmlTextReader(fs); | ||
85 | XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); | ||
86 | SerializableInventory inventory = (SerializableInventory)x.Deserialize(reader); | ||
87 | fs.Close(); | ||
88 | fs.Dispose(); | ||
89 | return inventory; | ||
90 | } | ||
91 | |||
92 | protected static void saveInventoryToStream(SerializableInventory inventory, Stream s) | ||
82 | { | 93 | { |
83 | foreach (KeyValuePair<string, IInventoryData> kvp in _plugins) | 94 | XmlTextWriter writer = new XmlTextWriter(s, Encoding.UTF8); |
95 | writer.Formatting = Formatting.Indented; | ||
96 | XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); | ||
97 | x.Serialize(writer, inventory); | ||
98 | } | ||
99 | |||
100 | protected static bool fixupFolder(SerializableInventory.SerializableFolder f, SerializableInventory.SerializableFolder parent) | ||
101 | { | ||
102 | bool modified = false; | ||
103 | |||
104 | // ensure we have a valid folder id | ||
105 | if (f.folderID == LLUUID.Zero) | ||
84 | { | 106 | { |
85 | try | 107 | f.folderID = LLUUID.Random(); |
86 | { | 108 | modified = true; |
87 | return kvp.Value.getUserRootFolders(user); | 109 | } |
88 | } | 110 | |
89 | catch (Exception e) | 111 | // ensure we have valid agent id |
90 | { | 112 | if (f.agentID == LLUUID.Zero) |
91 | OpenSim.Framework.Console.MainConsole.Instance.Notice("Unable to get root folders via " + kvp.Key + " (" + e.ToString() + ")"); | 113 | { |
92 | } | 114 | if (parent != null) |
115 | f.agentID = parent.agentID; | ||
116 | else | ||
117 | f.agentID = f.folderID; | ||
118 | modified = true; | ||
119 | } | ||
120 | |||
121 | if (f.parentID == LLUUID.Zero && parent != null) | ||
122 | { | ||
123 | f.parentID = parent.folderID; | ||
124 | modified = true; | ||
93 | } | 125 | } |
94 | return null; | 126 | |
127 | |||
128 | foreach (SerializableInventory.SerializableFolder child in f.SubFolders) | ||
129 | { | ||
130 | modified |= fixupFolder(child, f); | ||
131 | } | ||
132 | |||
133 | return modified; | ||
95 | } | 134 | } |
96 | 135 | ||
97 | public XmlRpcResponse XmlRpcInventoryRequest(XmlRpcRequest request) | 136 | protected static bool fixupInventory(SerializableInventory inventory) |
98 | { | 137 | { |
99 | XmlRpcResponse response = new XmlRpcResponse(); | 138 | return fixupFolder(inventory.root, null); |
100 | Hashtable requestData = (Hashtable)request.Params[0]; | 139 | } |
101 | 140 | ||
102 | Hashtable responseData = new Hashtable(); | 141 | public class GetInventory : BaseStreamHandler |
142 | { | ||
143 | private SerializableInventory _inventory; | ||
144 | private InventoryManager _manager; | ||
145 | public GetInventory(InventoryManager manager) | ||
146 | : base("GET", "/inventory") | ||
147 | { | ||
148 | _manager = manager; | ||
103 | 149 | ||
104 | // Stuff happens here | 150 | _inventory = loadInventoryFromXmlFile("Inventory_Library.xml"); |
151 | if (fixupInventory(_inventory)) | ||
152 | { | ||
153 | FileStream fs = new FileStream("Inventory_Library.xml", FileMode.Truncate, FileAccess.Write); | ||
154 | saveInventoryToStream(_inventory, fs); | ||
155 | fs.Flush(); | ||
156 | fs.Close(); | ||
157 | MainLog.Instance.Debug(OpenInventory_Main.LogName, "Modified"); | ||
158 | } | ||
159 | } | ||
105 | 160 | ||
106 | if (requestData.ContainsKey("Access-type")) | 161 | private void CreateDefaultInventory(LLUUID userID) |
107 | { | 162 | { |
108 | if (requestData["access-type"] == "rootfolders") | 163 | } |
164 | |||
165 | private byte[] GetUserInventory(LLUUID userID) | ||
166 | { | ||
167 | MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToStringHyphenated()); | ||
168 | byte[] result = new byte[] { }; | ||
169 | |||
170 | InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID); | ||
171 | if (fb == null) | ||
109 | { | 172 | { |
110 | // responseData["rootfolders"] = | 173 | MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", userID.ToStringHyphenated()); |
174 | CreateDefaultInventory(userID); | ||
111 | } | 175 | } |
176 | |||
177 | return result; | ||
112 | } | 178 | } |
113 | else | 179 | |
180 | override public byte[] Handle(string path, Stream request) | ||
114 | { | 181 | { |
115 | responseData["error"] = "No access-type specified."; | 182 | byte[] result = new byte[] { }; |
116 | } | ||
117 | 183 | ||
184 | string[] parms = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | ||
185 | if (parms.Length >= 1) | ||
186 | { | ||
187 | if (string.Compare(parms[1], "library", true) == 0) | ||
188 | { | ||
118 | 189 | ||
119 | // Stuff stops happening here | 190 | MemoryStream ms = new MemoryStream(); |
191 | saveInventoryToStream(_inventory, ms); | ||
120 | 192 | ||
121 | response.Value = responseData; | 193 | result = ms.GetBuffer(); |
122 | return response; | 194 | Array.Resize<byte>(ref result, (int)ms.Length); |
195 | } | ||
196 | else if (string.Compare(parms[1], "user", true) == 0) | ||
197 | { | ||
198 | if (parms.Length >= 2) | ||
199 | { | ||
200 | result = GetUserInventory(new LLUUID(parms[2])); | ||
201 | } | ||
202 | } | ||
203 | } | ||
204 | return result; | ||
205 | } | ||
123 | } | 206 | } |
207 | |||
124 | } | 208 | } |
125 | } | 209 | } |
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs index 97addb0..1bc396b 100644 --- a/OpenSim/Grid/InventoryServer/Main.cs +++ b/OpenSim/Grid/InventoryServer/Main.cs | |||
@@ -31,48 +31,71 @@ using System.Collections.Generic; | |||
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using System.IO; | 32 | using System.IO; |
33 | using System.Text; | 33 | using System.Text; |
34 | |||
34 | using libsecondlife; | 35 | using libsecondlife; |
35 | using OpenSim.Framework.User; | 36 | |
36 | using OpenSim.Framework.Sims; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Inventory; | ||
38 | using OpenSim.Framework.Interfaces; | ||
39 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
40 | using OpenSim.Servers; | 39 | using OpenSim.Framework.Servers; |
41 | using OpenSim.Framework.Utilities; | 40 | |
41 | using InventoryManager = OpenSim.Grid.InventoryServer.InventoryManager; | ||
42 | 42 | ||
43 | namespace OpenGridServices.InventoryServer | 43 | namespace OpenSim.Grid.InventoryServer |
44 | { | 44 | { |
45 | public class OpenInventory_Main : BaseServer, conscmd_callback | 45 | public class OpenInventory_Main : conscmd_callback |
46 | { | 46 | { |
47 | ConsoleBase m_console; | 47 | LogBase m_console; |
48 | InventoryManager m_inventoryManager; | 48 | InventoryManager m_inventoryManager; |
49 | InventoryConfig m_config; | ||
49 | 50 | ||
51 | public const string LogName = "INVENTORY"; | ||
52 | |||
53 | [STAThread] | ||
50 | public static void Main(string[] args) | 54 | public static void Main(string[] args) |
51 | { | 55 | { |
56 | OpenInventory_Main theServer = new OpenInventory_Main(); | ||
57 | theServer.Startup(); | ||
58 | |||
59 | theServer.Work(); | ||
52 | } | 60 | } |
53 | 61 | ||
54 | public OpenInventory_Main() | 62 | public OpenInventory_Main() |
55 | { | 63 | { |
56 | m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false); | 64 | m_console = new LogBase("opengrid-inventory-console.log", LogName, this, true); |
57 | MainConsole.Instance = m_console; | 65 | MainLog.Instance = m_console; |
58 | } | 66 | } |
59 | 67 | ||
60 | public void Startup() | 68 | public void Startup() |
61 | { | 69 | { |
62 | MainConsole.Instance.Notice("Initialising inventory manager..."); | 70 | MainLog.Instance.Notice("Initialising inventory manager..."); |
71 | m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); | ||
72 | |||
63 | m_inventoryManager = new InventoryManager(); | 73 | m_inventoryManager = new InventoryManager(); |
74 | m_inventoryManager.AddDatabasePlugin(m_config.DatabaseProvider); | ||
75 | MainLog.Instance.Notice(LogName, "Starting HTTP server ..."); | ||
76 | BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); | ||
64 | 77 | ||
65 | MainConsole.Instance.Notice("Starting HTTP server"); | 78 | httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); |
66 | BaseHttpServer httpServer = new BaseHttpServer(8004); | ||
67 | 79 | ||
68 | httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest); | 80 | httpServer.Start(); |
69 | //httpServer.AddRestHandler("GET","/rootfolders/",Rest | 81 | MainLog.Instance.Notice(LogName, "Started HTTP server"); |
82 | } | ||
83 | |||
84 | private void Work() | ||
85 | { | ||
86 | m_console.Notice("Enter help for a list of commands\n"); | ||
87 | |||
88 | while (true) | ||
89 | { | ||
90 | m_console.MainLogPrompt(); | ||
91 | } | ||
70 | } | 92 | } |
71 | 93 | ||
72 | public void RunCmd(string cmd, string[] cmdparams) | 94 | public void RunCmd(string cmd, string[] cmdparams) |
73 | { | 95 | { |
74 | switch (cmd) | 96 | switch (cmd) |
75 | { | 97 | { |
98 | case "quit": | ||
76 | case "shutdown": | 99 | case "shutdown": |
77 | m_console.Close(); | 100 | m_console.Close(); |
78 | Environment.Exit(0); | 101 | Environment.Exit(0); |
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 7245482..6be067f 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -175,6 +175,7 @@ namespace OpenSim | |||
175 | config.Set("user_send_key", "null"); | 175 | config.Set("user_send_key", "null"); |
176 | config.Set("user_recv_key", "null"); | 176 | config.Set("user_recv_key", "null"); |
177 | config.Set("asset_server_url", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString()); | 177 | config.Set("asset_server_url", "http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString()); |
178 | config.Set("inventory_server_url", "http://127.0.0.1:" + InventoryConfig.DefaultHttpPort.ToString()); | ||
178 | } | 179 | } |
179 | } | 180 | } |
180 | 181 | ||
@@ -774,4 +775,4 @@ namespace OpenSim | |||
774 | 775 | ||
775 | #endregion | 776 | #endregion |
776 | } | 777 | } |
777 | } \ No newline at end of file | 778 | } |
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs index 7d1780c..89e5465 100644 --- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs +++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs | |||
@@ -770,4 +770,4 @@ namespace OpenSim.Region.ClientStack | |||
770 | OutPacket(logReply); | 770 | OutPacket(logReply); |
771 | } | 771 | } |
772 | } | 772 | } |
773 | } \ No newline at end of file | 773 | } |
diff --git a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs index 941cc30..1281a44 100644 --- a/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs +++ b/OpenSim/Region/Communications/OGS1/CommunicationsOGS1.cs | |||
@@ -42,8 +42,8 @@ namespace OpenSim.Region.Communications.OGS1 | |||
42 | m_gridService = gridInterComms; | 42 | m_gridService = gridInterComms; |
43 | m_interRegion = gridInterComms; | 43 | m_interRegion = gridInterComms; |
44 | 44 | ||
45 | m_inventoryService = new OGS1InventoryService(); | 45 | m_inventoryService = new OGS1InventoryService(serversInfo.InventoryURL); |
46 | m_userService = new OGS1UserServices(this); | 46 | m_userService = new OGS1UserServices(this); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | } \ No newline at end of file | 49 | } |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs index 49fdee9..85df353 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs | |||
@@ -25,7 +25,9 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | using System; | |
29 | using System.IO; | ||
30 | using System.Xml.Serialization; | ||
29 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
30 | using libsecondlife; | 32 | using libsecondlife; |
31 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -36,8 +38,11 @@ namespace OpenSim.Region.Communications.OGS1 | |||
36 | { | 38 | { |
37 | public class OGS1InventoryService : IInventoryServices | 39 | public class OGS1InventoryService : IInventoryServices |
38 | { | 40 | { |
39 | public OGS1InventoryService() | 41 | string _inventoryServerUrl; |
42 | |||
43 | public OGS1InventoryService(string inventoryServerUrl) | ||
40 | { | 44 | { |
45 | _inventoryServerUrl = inventoryServerUrl; | ||
41 | } | 46 | } |
42 | 47 | ||
43 | #region IInventoryServices Members | 48 | #region IInventoryServices Members |
@@ -45,6 +50,19 @@ namespace OpenSim.Region.Communications.OGS1 | |||
45 | public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, | 50 | public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, |
46 | InventoryItemInfo itemCallBack) | 51 | InventoryItemInfo itemCallBack) |
47 | { | 52 | { |
53 | //TODO! Uncomment when all is done | ||
54 | //SerializableInventory userInventory = null; | ||
55 | |||
56 | //RestClient inventoryServer = new RestClient(_inventoryServerUrl); | ||
57 | //inventoryServer.AddResourcePath("inventory"); | ||
58 | //inventoryServer.AddResourcePath("user"); | ||
59 | //inventoryServer.AddResourcePath(userID.ToStringHyphenated()); | ||
60 | |||
61 | //using (Stream userInventoryStream = inventoryServer.Request()) | ||
62 | //{ | ||
63 | // XmlSerializer x = new XmlSerializer(typeof(SerializableInventory)); | ||
64 | // userInventory = (SerializableInventory)x.Deserialize(userInventoryStream); | ||
65 | //} | ||
48 | } | 66 | } |
49 | 67 | ||
50 | public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) | 68 | public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder) |
@@ -70,4 +88,4 @@ namespace OpenSim.Region.Communications.OGS1 | |||
70 | 88 | ||
71 | #endregion | 89 | #endregion |
72 | } | 90 | } |
73 | } \ No newline at end of file | 91 | } |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 9d4187a..99b69e1 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -431,4 +431,4 @@ namespace OpenSim.Region.Environment.Modules | |||
431 | m_tcp.Close(); | 431 | m_tcp.Close(); |
432 | } | 432 | } |
433 | } | 433 | } |
434 | } \ No newline at end of file | 434 | } |
diff --git a/OpenSim/Region/Environment/Modules/WorldCommModule.cs b/OpenSim/Region/Environment/Modules/WorldCommModule.cs index 7a631d7..5af2ce3 100644 --- a/OpenSim/Region/Environment/Modules/WorldCommModule.cs +++ b/OpenSim/Region/Environment/Modules/WorldCommModule.cs | |||
@@ -490,4 +490,4 @@ namespace OpenSim.Region.Environment.Modules | |||
490 | return m_id; | 490 | return m_id; |
491 | } | 491 | } |
492 | } | 492 | } |
493 | } \ No newline at end of file | 493 | } |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 5155b41..3b73893 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -1059,4 +1059,4 @@ namespace OpenSim.Region.Environment.Scenes | |||
1059 | SendOurAppearance(m_controllingClient); | 1059 | SendOurAppearance(m_controllingClient); |
1060 | } | 1060 | } |
1061 | } | 1061 | } |
1062 | } \ No newline at end of file | 1062 | } |
diff --git a/bin/Inventory_Default.xml b/bin/Inventory_Default.xml new file mode 100644 index 0000000..898e241 --- /dev/null +++ b/bin/Inventory_Default.xml | |||
@@ -0,0 +1,62 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <inventory> | ||
3 | <folder> | ||
4 | <name>My Inventory</name> | ||
5 | <folderID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
6 | <type>9</type> | ||
7 | <folders> | ||
8 | <folder> | ||
9 | <name>Animations</name> | ||
10 | <type>20</type> | ||
11 | </folder> | ||
12 | <folder> | ||
13 | <name>Body Parts</name> | ||
14 | <type>13</type> | ||
15 | </folder> | ||
16 | <folder> | ||
17 | <name>Clothing</name> | ||
18 | <type>5</type> | ||
19 | </folder> | ||
20 | <folder> | ||
21 | <name>Gestures</name> | ||
22 | <type>21</type> | ||
23 | </folder> | ||
24 | <folder> | ||
25 | <name>Landmarks</name> | ||
26 | <type>3</type> | ||
27 | </folder> | ||
28 | <folder> | ||
29 | <name>Lost And Found</name> | ||
30 | <type>16</type> | ||
31 | </folder> | ||
32 | <folder> | ||
33 | <name>Notecards</name> | ||
34 | <type>7</type> | ||
35 | </folder> | ||
36 | <folder> | ||
37 | <name>Objects</name> | ||
38 | <type>6</type> | ||
39 | </folder> | ||
40 | <folder> | ||
41 | <name>Photo Album</name> | ||
42 | <type>15</type> | ||
43 | </folder> | ||
44 | <folder> | ||
45 | <name>Scripts</name> | ||
46 | <type>10</type> | ||
47 | </folder> | ||
48 | <folder> | ||
49 | <name>Sounds</name> | ||
50 | <type>1</type> | ||
51 | </folder> | ||
52 | <folder> | ||
53 | <name>Textures</name> | ||
54 | <type>0</type> | ||
55 | </folder> | ||
56 | <folder> | ||
57 | <name>Trash</name> | ||
58 | <type>14</type> | ||
59 | </folder> | ||
60 | </folders> | ||
61 | </folder> | ||
62 | </inventory> | ||
diff --git a/bin/Inventory_Library.xml b/bin/Inventory_Library.xml new file mode 100644 index 0000000..327b8da --- /dev/null +++ b/bin/Inventory_Library.xml | |||
@@ -0,0 +1,144 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <inventory xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
3 | <folder> | ||
4 | <name>Library</name> | ||
5 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
6 | <parentID UUID="00000000-0000-0000-0000-000000000000" /> | ||
7 | <folderID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
8 | <type>9</type> | ||
9 | <version>0</version> | ||
10 | <folders> | ||
11 | <folder> | ||
12 | <name>Animations</name> | ||
13 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
14 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
15 | <folderID UUID="d052e0a1-0bf7-4f2a-8982-472df8e4d226" /> | ||
16 | <type>20</type> | ||
17 | <version>0</version> | ||
18 | <folders /> | ||
19 | <items /> | ||
20 | </folder> | ||
21 | <folder> | ||
22 | <name>Body Parts</name> | ||
23 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
24 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
25 | <folderID UUID="52abdfa6-d50f-4743-b7db-b37f97857941" /> | ||
26 | <type>13</type> | ||
27 | <version>0</version> | ||
28 | <folders /> | ||
29 | <items /> | ||
30 | </folder> | ||
31 | <folder> | ||
32 | <name>Clothing</name> | ||
33 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
34 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
35 | <folderID UUID="5820e65c-eaa9-4404-a2bc-4c63fec47c83" /> | ||
36 | <type>5</type> | ||
37 | <version>0</version> | ||
38 | <folders /> | ||
39 | <items /> | ||
40 | </folder> | ||
41 | <folder> | ||
42 | <name>Gestures</name> | ||
43 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
44 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
45 | <folderID UUID="530e1f34-14fa-4129-a373-e4ee65249b78" /> | ||
46 | <type>21</type> | ||
47 | <version>0</version> | ||
48 | <folders /> | ||
49 | <items /> | ||
50 | </folder> | ||
51 | <folder> | ||
52 | <name>Landmarks</name> | ||
53 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
54 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
55 | <folderID UUID="a1419cef-d7d7-476e-a088-165c747532a2" /> | ||
56 | <type>3</type> | ||
57 | <version>0</version> | ||
58 | <folders /> | ||
59 | <items /> | ||
60 | </folder> | ||
61 | <folder> | ||
62 | <name>Lost And Found</name> | ||
63 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
64 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
65 | <folderID UUID="62c88a03-838c-4822-b912-10e4a9b831c5" /> | ||
66 | <type>3</type> | ||
67 | <version>0</version> | ||
68 | <folders /> | ||
69 | <items /> | ||
70 | </folder> | ||
71 | <folder> | ||
72 | <name>Notecards</name> | ||
73 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
74 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
75 | <folderID UUID="b61598ea-2312-49f9-9b1c-5214ba55facc" /> | ||
76 | <type>7</type> | ||
77 | <version>0</version> | ||
78 | <folders /> | ||
79 | <items /> | ||
80 | </folder> | ||
81 | <folder> | ||
82 | <name>Objects</name> | ||
83 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
84 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
85 | <folderID UUID="ff757447-ea4d-4769-8751-e3bb13cd570d" /> | ||
86 | <type>6</type> | ||
87 | <version>0</version> | ||
88 | <folders /> | ||
89 | <items /> | ||
90 | </folder> | ||
91 | <folder> | ||
92 | <name>Photo Album</name> | ||
93 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
94 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
95 | <folderID UUID="d6cadddd-68e1-4fc3-bd24-319cd593fdc0" /> | ||
96 | <type>15</type> | ||
97 | <version>0</version> | ||
98 | <folders /> | ||
99 | <items /> | ||
100 | </folder> | ||
101 | <folder> | ||
102 | <name>Scripts</name> | ||
103 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
104 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
105 | <folderID UUID="f0e2c3dc-3f44-4730-8b33-6a911994fea1" /> | ||
106 | <type>10</type> | ||
107 | <version>0</version> | ||
108 | <folders /> | ||
109 | <items /> | ||
110 | </folder> | ||
111 | <folder> | ||
112 | <name>Sounds</name> | ||
113 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
114 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
115 | <folderID UUID="b8815d3c-52b0-447c-adea-3a1a442dbb2b" /> | ||
116 | <type>1</type> | ||
117 | <version>0</version> | ||
118 | <folders /> | ||
119 | <items /> | ||
120 | </folder> | ||
121 | <folder> | ||
122 | <name>Textures</name> | ||
123 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
124 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
125 | <folderID UUID="23e487c5-43af-4fe6-b211-75cfc91845a6" /> | ||
126 | <type>0</type> | ||
127 | <version>0</version> | ||
128 | <folders /> | ||
129 | <items /> | ||
130 | </folder> | ||
131 | <folder> | ||
132 | <name>Accessories</name> | ||
133 | <agentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
134 | <parentID UUID="00000112-000f-0000-0000-000100bba000" /> | ||
135 | <folderID UUID="b4024e1c-9b1d-426e-a70e-55ae0078dc0b" /> | ||
136 | <type>8</type> | ||
137 | <version>0</version> | ||
138 | <folders /> | ||
139 | <items /> | ||
140 | </folder> | ||
141 | </folders> | ||
142 | <items /> | ||
143 | </folder> | ||
144 | </inventory> \ No newline at end of file | ||
diff --git a/prebuild.xml b/prebuild.xml index bc1cc78..79f8d3a 100644 --- a/prebuild.xml +++ b/prebuild.xml | |||
@@ -846,6 +846,34 @@ | |||
846 | </Files> | 846 | </Files> |
847 | </Project> | 847 | </Project> |
848 | 848 | ||
849 | <Project name="OpenSim.Grid.InventoryServer" path="OpenSim/Grid/InventoryServer" type="Exe"> | ||
850 | <Configuration name="Debug"> | ||
851 | <Options> | ||
852 | <OutputPath>../../../bin/</OutputPath> | ||
853 | </Options> | ||
854 | </Configuration> | ||
855 | <Configuration name="Release"> | ||
856 | <Options> | ||
857 | <OutputPath>../../../bin/</OutputPath> | ||
858 | </Options> | ||
859 | </Configuration> | ||
860 | |||
861 | <ReferencePath>../../../bin/</ReferencePath> | ||
862 | <Reference name="System" localCopy="false"/> | ||
863 | <Reference name="System.Data" localCopy="false"/> | ||
864 | <Reference name="System.Xml" localCopy="false"/> | ||
865 | <Reference name="OpenSim.Framework"/> | ||
866 | <Reference name="OpenSim.Framework.Console"/> | ||
867 | <Reference name="OpenSim.Framework.Communications"/> | ||
868 | <Reference name="OpenSim.Framework.Data"/> | ||
869 | <Reference name="OpenSim.Framework.Servers"/> | ||
870 | <Reference name="libsecondlife.dll"/> | ||
871 | |||
872 | <Files> | ||
873 | <Match pattern="*.cs" recurse="true"/> | ||
874 | </Files> | ||
875 | </Project> | ||
876 | |||
849 | <Project name="OpenSim.Region.ScriptEngine.Common" path="OpenSim/Region/ScriptEngine/Common" type="Library"> | 877 | <Project name="OpenSim.Region.ScriptEngine.Common" path="OpenSim/Region/ScriptEngine/Common" type="Library"> |
850 | <Configuration name="Debug"> | 878 | <Configuration name="Debug"> |
851 | <Options> | 879 | <Options> |
@@ -1054,3 +1082,4 @@ | |||
1054 | 1082 | ||
1055 | 1083 | ||
1056 | 1084 | ||
1085 | |||