aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/InventoryServer/Main.cs
diff options
context:
space:
mode:
authorlbsa712007-09-27 14:57:43 +0000
committerlbsa712007-09-27 14:57:43 +0000
commit863195612bdef56165f2b4354bab280c371618b9 (patch)
tree63cec15a6c0338a8777640ed13fd7c3ce05eeba7 /OpenSim/Grid/InventoryServer/Main.cs
parentrevert change to libsecondlife.dll.config which breaks Linux (diff)
downloadopensim-SC_OLD-863195612bdef56165f2b4354bab280c371618b9.zip
opensim-SC_OLD-863195612bdef56165f2b4354bab280c371618b9.tar.gz
opensim-SC_OLD-863195612bdef56165f2b4354bab280c371618b9.tar.bz2
opensim-SC_OLD-863195612bdef56165f2b4354bab280c371618b9.tar.xz
Reverting back to 2017 since 2018 were causing Linux breakage; reopening Tleiades patch 444 and 445.
Diffstat (limited to 'OpenSim/Grid/InventoryServer/Main.cs')
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs113
1 files changed, 16 insertions, 97 deletions
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 392c741..97addb0 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -31,130 +31,49 @@ using System.Collections.Generic;
31using System.Reflection; 31using System.Reflection;
32using System.IO; 32using System.IO;
33using System.Text; 33using System.Text;
34using System.Xml;
35
36using libsecondlife; 34using libsecondlife;
35using OpenSim.Framework.User;
36using OpenSim.Framework.Sims;
37using OpenSim.Framework.Inventory;
37using OpenSim.Framework.Interfaces; 38using OpenSim.Framework.Interfaces;
38using OpenSim.Framework.Console; 39using OpenSim.Framework.Console;
40using OpenSim.Servers;
39using OpenSim.Framework.Utilities; 41using OpenSim.Framework.Utilities;
40using OpenSim.Framework.Configuration;
41using OpenSim.Framework.Data;
42using InventoryCategory = OpenSim.Framework.Data.InventoryCategory;
43 42
44namespace OpenSim.Grid.InventoryServer 43namespace OpenGridServices.InventoryServer
45{ 44{
46 45 public class OpenInventory_Main : BaseServer, conscmd_callback
47 public class OpenInventory_Main : conscmd_callback
48 { 46 {
47 ConsoleBase m_console;
48 InventoryManager m_inventoryManager;
49 49
50 public const string MainLogName = "INVENTORY";
51
52 private InventoryConfig m_config;
53 LogBase m_console;
54 InventoryManager m_inventoryManager; ///connection the database backend
55 InventoryService m_inventoryService; ///Remoting interface, where messages arrive
56 [STAThread]
57 public static void Main(string[] args) 50 public static void Main(string[] args)
58 { 51 {
59 Console.WriteLine("Launching InventoryServer...");
60
61 OpenInventory_Main inventoryServer = new OpenInventory_Main();
62
63 inventoryServer.Startup();
64
65// inventoryServer.RunCmd("load", new string[] { "library", "inventory_library.xml" });
66// inventoryServer.RunCmd("load", new string[] { "default", "inventory_default.xml" });
67
68 inventoryServer.Work();
69 } 52 }
70 53
71 public OpenInventory_Main() 54 public OpenInventory_Main()
72 { 55 {
73 56 m_console = new ConsoleBase("opengrid-inventory-console.log", "OpenInventory", this, false);
74 if (!Directory.Exists(Util.logDir())) 57 MainConsole.Instance = m_console;
75 {
76 Directory.CreateDirectory(Util.logDir());
77 }
78
79 m_console = new LogBase(Path.Combine(Util.logDir(), "opensim-inventory-console.log"), "OpenInventory", this, false);
80 MainLog.Instance = m_console;
81 }
82
83 private void Work()
84 {
85 m_console.Notice(OpenInventory_Main.MainLogName, "Enter help for a list of commands\n");
86
87 while (true)
88 {
89 m_console.MainLogPrompt();
90 }
91 } 58 }
92 59
93 public void Startup() 60 public void Startup()
94 { 61 {
95 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Initialising inventory manager..."); 62 MainConsole.Instance.Notice("Initialising inventory manager...");
96
97 m_config = new InventoryConfig(OpenInventory_Main.MainLogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
98
99 // instantiate the manager, responsible for doing the actual storage
100 m_inventoryManager = new InventoryManager(); 63 m_inventoryManager = new InventoryManager();
101 m_inventoryManager.AddDatabasePlugin(m_config.DatabaseProvider);
102
103 m_inventoryService = new InventoryService(m_inventoryManager, m_config);
104 64
105 // Dig out the embedded version number of this assembly 65 MainConsole.Instance.Notice("Starting HTTP server");
106 Assembly assembly = Assembly.GetExecutingAssembly(); 66 BaseHttpServer httpServer = new BaseHttpServer(8004);
107 string serverExeName = assembly.ManifestModule.Name;
108 Version serverExeVersion = AssemblyName.GetAssemblyName(serverExeName).Version;
109 67
110 m_console.Status(OpenInventory_Main.MainLogName, "Inventoryserver {0}.{1}.{2}.{3} - Startup complete", serverExeVersion.Major, serverExeVersion.Minor, serverExeVersion.Revision, serverExeVersion.Build); 68 httpServer.AddXmlRPCHandler("rootfolders", m_inventoryManager.XmlRpcInventoryRequest);
111 } 69 //httpServer.AddRestHandler("GET","/rootfolders/",Rest
112
113
114 public void Load(string[] cmdparams)
115 {
116 string cmd = cmdparams[0];
117 string fileName = cmdparams[1];
118
119 if (cmdparams.Length != 2)
120 {
121 cmd = "help";
122 }
123
124 switch (cmd)
125 {
126 case "library":
127 InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.Library, fileName);
128 break;
129 case "default":
130 InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.Default, fileName);
131 break;
132 case "user":
133 InventoryServiceSingleton.Instance.loadInventoryFromXmlFile(InventoryCategory.User, fileName);
134 break;
135 case "help":
136 m_console.Notice("load library <filename>, load library inventory, shared between all users");
137 m_console.Notice("load default <filename>, load template inventory, used when creating a new user inventory");
138 m_console.Notice("load user <first> <last>, load inventory for a specific users, warning this will reset the contents of the inventory");
139 break;
140 }
141 } 70 }
142 71
143 public void RunCmd(string cmd, string[] cmdparams) 72 public void RunCmd(string cmd, string[] cmdparams)
144 { 73 {
145 switch (cmd) 74 switch (cmd)
146 { 75 {
147 case "help":
148 m_console.Notice("load - load verious inventories, use \"load help\", to see a list of commands");
149 m_console.Notice("shutdown - shutdown the grid (USE CAUTION!)");
150 m_console.Notice("quit - shutdown the grid (USE CAUTION!)");
151 break;
152 case "load":
153 Load(cmdparams);
154 break;
155 case "quit":
156 case "shutdown": 76 case "shutdown":
157 MainLog.Instance.Verbose(OpenInventory_Main.MainLogName, "Shutting down inventory server");
158 m_console.Close(); 77 m_console.Close();
159 Environment.Exit(0); 78 Environment.Exit(0);
160 break; 79 break;