aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Grid/InventoryServer
diff options
context:
space:
mode:
authorJeff Ames2008-02-05 19:44:27 +0000
committerJeff Ames2008-02-05 19:44:27 +0000
commit6ed5283bc06a62f38eb517e67b975832b603bf61 (patch)
treee5f635018789b73a99ddeca0883a68368fa5eece /OpenSim/Grid/InventoryServer
parentCut down on the number of packets sent during terraforming. Terraforming shou... (diff)
downloadopensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.zip
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.gz
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.bz2
opensim-SC_OLD-6ed5283bc06a62f38eb517e67b975832b603bf61.tar.xz
Converted logging to use log4net.
Changed LogBase to ConsoleBase, which handles console I/O. This is mostly an in-place conversion, so lots of refactoring can still be done.
Diffstat (limited to 'OpenSim/Grid/InventoryServer')
-rw-r--r--OpenSim/Grid/InventoryServer/GridInventoryService.cs24
-rw-r--r--OpenSim/Grid/InventoryServer/InventoryManager.cs16
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs22
3 files changed, 35 insertions, 27 deletions
diff --git a/OpenSim/Grid/InventoryServer/GridInventoryService.cs b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
index d36a915..a719452 100644
--- a/OpenSim/Grid/InventoryServer/GridInventoryService.cs
+++ b/OpenSim/Grid/InventoryServer/GridInventoryService.cs
@@ -37,6 +37,8 @@ namespace OpenSim.Grid.InventoryServer
37{ 37{
38 public class GridInventoryService : InventoryServiceBase 38 public class GridInventoryService : InventoryServiceBase
39 { 39 {
40 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
41
40 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, 42 public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
41 InventoryItemInfo itemCallBack) 43 InventoryItemInfo itemCallBack)
42 { 44 {
@@ -108,7 +110,7 @@ namespace OpenSim.Grid.InventoryServer
108 LLUUID userID = new LLUUID(rawUserID); 110 LLUUID userID = new LLUUID(rawUserID);
109 111
110 // We get enough verbose messages later on for diagnostics 112 // We get enough verbose messages later on for diagnostics
111 //MainLog.Instance.Verbose("INVENTORY", "Request for inventory for " + userID.ToString()); 113 //m_log.Info("[INVENTORY]: Request for inventory for " + userID.ToString());
112 114
113 InventoryCollection invCollection = new InventoryCollection(); 115 InventoryCollection invCollection = new InventoryCollection();
114 List<InventoryFolderBase> folders; 116 List<InventoryFolderBase> folders;
@@ -126,8 +128,8 @@ namespace OpenSim.Grid.InventoryServer
126 { 128 {
127 LLUUID userID = new LLUUID(rawUserID); 129 LLUUID userID = new LLUUID(rawUserID);
128 130
129 MainLog.Instance.Verbose( 131 m_log.Info(
130 "INVENTORY", "Creating new set of inventory folders for " + userID.ToString()); 132 "[INVENTORY]: Creating new set of inventory folders for " + userID.ToString());
131 133
132 CreateNewUserInventory(userID); 134 CreateNewUserInventory(userID);
133 return true; 135 return true;
@@ -152,8 +154,8 @@ namespace OpenSim.Grid.InventoryServer
152 public bool AddInventoryFolder(InventoryFolderBase folder) 154 public bool AddInventoryFolder(InventoryFolderBase folder)
153 { 155 {
154 // Right now, this actions act more like an update/insert combination than a simple create. 156 // Right now, this actions act more like an update/insert combination than a simple create.
155 MainLog.Instance.Verbose( 157 m_log.Info(
156 "INVENTORY", 158 "[INVENTORY]: " +
157 "Updating in " + folder.parentID.ToString() 159 "Updating in " + folder.parentID.ToString()
158 + ", folder " + folder.name); 160 + ", folder " + folder.name);
159 161
@@ -163,8 +165,8 @@ namespace OpenSim.Grid.InventoryServer
163 165
164 public bool MoveInventoryFolder(InventoryFolderBase folder) 166 public bool MoveInventoryFolder(InventoryFolderBase folder)
165 { 167 {
166 MainLog.Instance.Verbose( 168 m_log.Info(
167 "INVENTORY", 169 "[INVENTORY]: " +
168 "Moving folder " + folder.folderID 170 "Moving folder " + folder.folderID
169 + " to " + folder.parentID.ToString()); 171 + " to " + folder.parentID.ToString());
170 172
@@ -175,8 +177,8 @@ namespace OpenSim.Grid.InventoryServer
175 public bool AddInventoryItem(InventoryItemBase item) 177 public bool AddInventoryItem(InventoryItemBase item)
176 { 178 {
177 // Right now, this actions act more like an update/insert combination than a simple create. 179 // Right now, this actions act more like an update/insert combination than a simple create.
178 MainLog.Instance.Verbose( 180 m_log.Info(
179 "INVENTORY", 181 "[INVENTORY]: " +
180 "Updating in " + item.parentFolderID.ToString() 182 "Updating in " + item.parentFolderID.ToString()
181 + ", item " + item.inventoryName); 183 + ", item " + item.inventoryName);
182 184
@@ -187,8 +189,8 @@ namespace OpenSim.Grid.InventoryServer
187 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item) 189 public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
188 { 190 {
189 // extra spaces to align with other inventory messages 191 // extra spaces to align with other inventory messages
190 MainLog.Instance.Verbose( 192 m_log.Info(
191 "INVENTORY", 193 "[INVENTORY]: " +
192 "Deleting in " + item.parentFolderID.ToString() 194 "Deleting in " + item.parentFolderID.ToString()
193 + ", item " + item.inventoryName); 195 + ", item " + item.inventoryName);
194 196
diff --git a/OpenSim/Grid/InventoryServer/InventoryManager.cs b/OpenSim/Grid/InventoryServer/InventoryManager.cs
index 6ca5064..35b66b2 100644
--- a/OpenSim/Grid/InventoryServer/InventoryManager.cs
+++ b/OpenSim/Grid/InventoryServer/InventoryManager.cs
@@ -41,6 +41,8 @@ namespace OpenSim.Grid.InventoryServer
41{ 41{
42 public class InventoryManager 42 public class InventoryManager
43 { 43 {
44 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
45
44 private IInventoryData _databasePlugin; 46 private IInventoryData _databasePlugin;
45 47
46 /// <summary> 48 /// <summary>
@@ -49,10 +51,10 @@ namespace OpenSim.Grid.InventoryServer
49 /// <param name="FileName">The filename to the inventory server plugin DLL</param> 51 /// <param name="FileName">The filename to the inventory server plugin DLL</param>
50 public void AddDatabasePlugin(string FileName) 52 public void AddDatabasePlugin(string FileName)
51 { 53 {
52 MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName); 54 m_log.Info("[" + OpenInventory_Main.LogName + "]: Invenstorage: Attempting to load " + FileName);
53 Assembly pluginAssembly = Assembly.LoadFrom(FileName); 55 Assembly pluginAssembly = Assembly.LoadFrom(FileName);
54 56
55 MainLog.Instance.Verbose(OpenInventory_Main.LogName, 57 m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
56 "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces."); 58 "Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
57 foreach (Type pluginType in pluginAssembly.GetTypes()) 59 foreach (Type pluginType in pluginAssembly.GetTypes())
58 { 60 {
@@ -66,7 +68,7 @@ namespace OpenSim.Grid.InventoryServer
66 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 68 (IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
67 plug.Initialise(); 69 plug.Initialise();
68 _databasePlugin = plug; 70 _databasePlugin = plug;
69 MainLog.Instance.Verbose(OpenInventory_Main.LogName, 71 m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
70 "Invenstorage: Added IInventoryData Interface"); 72 "Invenstorage: Added IInventoryData Interface");
71 break; 73 break;
72 } 74 }
@@ -156,7 +158,7 @@ namespace OpenSim.Grid.InventoryServer
156 saveInventoryToStream(_inventory, fs); 158 saveInventoryToStream(_inventory, fs);
157 fs.Flush(); 159 fs.Flush();
158 fs.Close(); 160 fs.Close();
159 MainLog.Instance.Debug(OpenInventory_Main.LogName, "Modified"); 161 m_log.Debug("[" + OpenInventory_Main.LogName + "]: Modified");
160 } 162 }
161 } 163 }
162 164
@@ -166,14 +168,14 @@ namespace OpenSim.Grid.InventoryServer
166 168
167 private byte[] GetUserInventory(LLUUID userID) 169 private byte[] GetUserInventory(LLUUID userID)
168 { 170 {
169 MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToString()); 171 m_log.Info(String.Format("[" + OpenInventory_Main.LogName + "]: Getting Inventory for user {0}", userID.ToString()));
170 byte[] result = new byte[] {}; 172 byte[] result = new byte[] {};
171 173
172 InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID); 174 InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID);
173 if (fb == null) 175 if (fb == null)
174 { 176 {
175 MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new", 177 m_log.Info(String.Format("[" + OpenInventory_Main.LogName + "]: Inventory not found for user {0}, creating new",
176 userID.ToString()); 178 userID.ToString()));
177 CreateDefaultInventory(userID); 179 CreateDefaultInventory(userID);
178 } 180 }
179 181
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index b62c696..5037c7d 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -38,6 +38,8 @@ namespace OpenSim.Grid.InventoryServer
38{ 38{
39 public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback 39 public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback
40 { 40 {
41 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42
41 private InventoryManager m_inventoryManager; 43 private InventoryManager m_inventoryManager;
42 private InventoryConfig m_config; 44 private InventoryConfig m_config;
43 private GridInventoryService m_inventoryService; 45 private GridInventoryService m_inventoryService;
@@ -47,6 +49,8 @@ namespace OpenSim.Grid.InventoryServer
47 [STAThread] 49 [STAThread]
48 public static void Main(string[] args) 50 public static void Main(string[] args)
49 { 51 {
52 log4net.Config.XmlConfigurator.Configure();
53
50 OpenInventory_Main theServer = new OpenInventory_Main(); 54 OpenInventory_Main theServer = new OpenInventory_Main();
51 theServer.Startup(); 55 theServer.Startup();
52 56
@@ -55,20 +59,20 @@ namespace OpenSim.Grid.InventoryServer
55 59
56 public OpenInventory_Main() 60 public OpenInventory_Main()
57 { 61 {
58 m_log = new LogBase("opengrid-inventory-console.log", LogName, this, true); 62 m_console = new ConsoleBase(LogName, this);
59 MainLog.Instance = m_log; 63 MainConsole.Instance = m_console;
60 } 64 }
61 65
62 public void Startup() 66 public void Startup()
63 { 67 {
64 MainLog.Instance.Notice("Initialising inventory manager..."); 68 m_log.Info("Initialising inventory manager...");
65 m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); 69 m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
66 70
67 m_inventoryService = new GridInventoryService(); 71 m_inventoryService = new GridInventoryService();
68 // m_inventoryManager = new InventoryManager(); 72 // m_inventoryManager = new InventoryManager();
69 m_inventoryService.AddPlugin(m_config.DatabaseProvider); 73 m_inventoryService.AddPlugin(m_config.DatabaseProvider);
70 74
71 MainLog.Instance.Notice(LogName, "Starting HTTP server ..."); 75 m_log.Info("[" + LogName + "]: Starting HTTP server ...");
72 BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort); 76 BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort);
73 httpServer.AddStreamHandler( 77 httpServer.AddStreamHandler(
74 new RestDeserialisehandler<Guid, InventoryCollection>("POST", "/GetInventory/", 78 new RestDeserialisehandler<Guid, InventoryCollection>("POST", "/GetInventory/",
@@ -95,19 +99,19 @@ namespace OpenSim.Grid.InventoryServer
95 new RestDeserialisehandler<Guid, List<InventoryFolderBase>>("POST", "/RootFolders/", 99 new RestDeserialisehandler<Guid, List<InventoryFolderBase>>("POST", "/RootFolders/",
96 m_inventoryService.RequestFirstLevelFolders)); 100 m_inventoryService.RequestFirstLevelFolders));
97 101
98 // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager)); 102 // httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager));
99 103
100 httpServer.Start(); 104 httpServer.Start();
101 MainLog.Instance.Notice(LogName, "Started HTTP server"); 105 m_log.Info("[" + LogName + "]: Started HTTP server");
102 } 106 }
103 107
104 private void Work() 108 private void Work()
105 { 109 {
106 m_log.Notice("Enter help for a list of commands\n"); 110 m_console.Notice("Enter help for a list of commands\n");
107 111
108 while (true) 112 while (true)
109 { 113 {
110 m_log.MainLogPrompt(); 114 m_console.Prompt();
111 } 115 }
112 } 116 }
113 117
@@ -122,7 +126,7 @@ namespace OpenSim.Grid.InventoryServer
122 m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID); 126 m_inventoryService.CreateUsersInventory(LLUUID.Random().UUID);
123 break; 127 break;
124 case "shutdown": 128 case "shutdown":
125 m_log.Close(); 129 m_console.Close();
126 Environment.Exit(0); 130 Environment.Exit(0);
127 break; 131 break;
128 } 132 }