* Rex merges, Inventory server

afrisby-3
Adam Frisby 2008-02-23 02:45:16 +00:00
parent 79cb89f406
commit f06b6e2274
3 changed files with 553 additions and 548 deletions

View File

@ -37,6 +37,8 @@ namespace OpenSim.Grid.InventoryServer
{
public class GridInventoryService : InventoryServiceBase
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
InventoryItemInfo itemCallBack)
{
@ -108,7 +110,7 @@ namespace OpenSim.Grid.InventoryServer
LLUUID userID = new LLUUID(rawUserID);
// We get enough verbose messages later on for diagnostics
//MainLog.Instance.Verbose("INVENTORY", "Request for inventory for " + userID.ToString());
//m_log.Info("[INVENTORY]: Request for inventory for " + userID.ToString());
InventoryCollection invCollection = new InventoryCollection();
List<InventoryFolderBase> folders;
@ -126,8 +128,8 @@ namespace OpenSim.Grid.InventoryServer
{
LLUUID userID = new LLUUID(rawUserID);
MainLog.Instance.Verbose(
"INVENTORY", "Creating new set of inventory folders for " + userID.ToString());
m_log.Info(
"[INVENTORY]: Creating new set of inventory folders for " + userID.ToString());
CreateNewUserInventory(userID);
return true;
@ -152,8 +154,8 @@ namespace OpenSim.Grid.InventoryServer
public bool AddInventoryFolder(InventoryFolderBase folder)
{
// Right now, this actions act more like an update/insert combination than a simple create.
MainLog.Instance.Verbose(
"INVENTORY",
m_log.Info(
"[INVENTORY]: " +
"Updating in " + folder.parentID.ToString()
+ ", folder " + folder.name);
@ -163,8 +165,8 @@ namespace OpenSim.Grid.InventoryServer
public bool MoveInventoryFolder(InventoryFolderBase folder)
{
MainLog.Instance.Verbose(
"INVENTORY",
m_log.Info(
"[INVENTORY]: " +
"Moving folder " + folder.folderID
+ " to " + folder.parentID.ToString());
@ -175,8 +177,8 @@ namespace OpenSim.Grid.InventoryServer
public bool AddInventoryItem(InventoryItemBase item)
{
// Right now, this actions act more like an update/insert combination than a simple create.
MainLog.Instance.Verbose(
"INVENTORY",
m_log.Info(
"[INVENTORY]: " +
"Updating in " + item.parentFolderID.ToString()
+ ", item " + item.inventoryName);
@ -187,8 +189,8 @@ namespace OpenSim.Grid.InventoryServer
public override void DeleteInventoryItem(LLUUID userID, InventoryItemBase item)
{
// extra spaces to align with other inventory messages
MainLog.Instance.Verbose(
"INVENTORY",
m_log.Info(
"[INVENTORY]: " +
"Deleting in " + item.parentFolderID.ToString()
+ ", item " + item.inventoryName);

View File

@ -41,6 +41,8 @@ namespace OpenSim.Grid.InventoryServer
{
public class InventoryManager
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private IInventoryData _databasePlugin;
/// <summary>
@ -49,10 +51,10 @@ namespace OpenSim.Grid.InventoryServer
/// <param name="FileName">The filename to the inventory server plugin DLL</param>
public void AddDatabasePlugin(string FileName)
{
MainLog.Instance.Verbose(OpenInventory_Main.LogName, "Invenstorage: Attempting to load " + FileName);
m_log.Info("[" + OpenInventory_Main.LogName + "]: Invenstorage: Attempting to load " + FileName);
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
MainLog.Instance.Verbose(OpenInventory_Main.LogName,
m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
"Invenstorage: Found " + pluginAssembly.GetTypes().Length + " interfaces.");
foreach (Type pluginType in pluginAssembly.GetTypes())
{
@ -66,7 +68,7 @@ namespace OpenSim.Grid.InventoryServer
(IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise();
_databasePlugin = plug;
MainLog.Instance.Verbose(OpenInventory_Main.LogName,
m_log.Info("[" + OpenInventory_Main.LogName + "]: " +
"Invenstorage: Added IInventoryData Interface");
break;
}
@ -156,7 +158,7 @@ namespace OpenSim.Grid.InventoryServer
saveInventoryToStream(_inventory, fs);
fs.Flush();
fs.Close();
MainLog.Instance.Debug(OpenInventory_Main.LogName, "Modified");
m_log.Debug("[" + OpenInventory_Main.LogName + "]: Modified");
}
}
@ -166,14 +168,14 @@ namespace OpenSim.Grid.InventoryServer
private byte[] GetUserInventory(LLUUID userID)
{
MainLog.Instance.Notice(OpenInventory_Main.LogName, "Getting Inventory for user {0}", userID.ToString());
m_log.InfoFormat("[" + OpenInventory_Main.LogName + "]: Getting Inventory for user {0}", userID.ToString());
byte[] result = new byte[] {};
InventoryFolderBase fb = _manager._databasePlugin.getUserRootFolder(userID);
if (fb == null)
{
MainLog.Instance.Notice(OpenInventory_Main.LogName, "Inventory not found for user {0}, creating new",
userID.ToString());
m_log.InfoFormat("[" + OpenInventory_Main.LogName + "]: Inventory not found for user {0}, creating new",
userID.ToString());
CreateDefaultInventory(userID);
}

View File

@ -36,9 +36,10 @@ using OpenSim.Framework.Servers;
namespace OpenSim.Grid.InventoryServer
{
public class OpenInventory_Main : conscmd_callback
public class OpenInventory_Main : BaseOpenSimServer, conscmd_callback
{
private LogBase m_console;
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private InventoryManager m_inventoryManager;
private InventoryConfig m_config;
private GridInventoryService m_inventoryService;
@ -48,6 +49,8 @@ namespace OpenSim.Grid.InventoryServer
[STAThread]
public static void Main(string[] args)
{
log4net.Config.XmlConfigurator.Configure();
OpenInventory_Main theServer = new OpenInventory_Main();
theServer.Startup();
@ -56,20 +59,20 @@ namespace OpenSim.Grid.InventoryServer
public OpenInventory_Main()
{
m_console = new LogBase("opengrid-inventory-console.log", LogName, this, true);
MainLog.Instance = m_console;
m_console = new ConsoleBase(LogName, this);
MainConsole.Instance = m_console;
}
public void Startup()
{
MainLog.Instance.Notice("Initialising inventory manager...");
m_log.Info("Initialising inventory manager...");
m_config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
m_inventoryService = new GridInventoryService();
// m_inventoryManager = new InventoryManager();
m_inventoryService.AddPlugin(m_config.DatabaseProvider);
MainLog.Instance.Notice(LogName, "Starting HTTP server ...");
m_log.Info("[" + LogName + "]: Starting HTTP server ...");
BaseHttpServer httpServer = new BaseHttpServer(m_config.HttpPort);
httpServer.AddStreamHandler(
new RestDeserialisehandler<Guid, InventoryCollection>("POST", "/GetInventory/",
@ -96,10 +99,10 @@ namespace OpenSim.Grid.InventoryServer
new RestDeserialisehandler<Guid, List<InventoryFolderBase>>("POST", "/RootFolders/",
m_inventoryService.RequestFirstLevelFolders));
// httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager));
// httpServer.AddStreamHandler(new InventoryManager.GetInventory(m_inventoryManager));
httpServer.Start();
MainLog.Instance.Notice(LogName, "Started HTTP server");
m_log.Info("[" + LogName + "]: Started HTTP server");
}
private void Work()
@ -108,12 +111,14 @@ namespace OpenSim.Grid.InventoryServer
while (true)
{
m_console.MainLogPrompt();
m_console.Prompt();
}
}
public void RunCmd(string cmd, string[] cmdparams)
public override void RunCmd(string cmd, string[] cmdparams)
{
base.RunCmd(cmd, cmdparams);
switch (cmd)
{
case "quit":
@ -126,9 +131,5 @@ namespace OpenSim.Grid.InventoryServer
break;
}
}
public void Show(string ShowWhat)
{
}
}
}