From bf4d701cd5ae74dfc0d52feddee1614b93f5a569 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Fri, 27 Mar 2009 12:49:27 +0000 Subject: [PATCH] From: Alan Webb Fixed problem with REST services caused by changes to the OpenSim core code base - the comms manager had been 'modularized'. Also added additional debugging to RemoteAdmin interface. --- .../RemoteController/RemoteAdminPlugin.cs | 37 ++++++++++++++---- .../ApplicationPlugins/Rest/Inventory/Rest.cs | 38 ++++++++++++++++--- .../Rest/Inventory/RestAppearanceServices.cs | 10 ----- .../Rest/Inventory/RestAssetServices.cs | 6 --- .../Rest/Inventory/RestHandler.cs | 11 ++---- .../Rest/Inventory/RestInventoryServices.cs | 14 ------- 6 files changed, 67 insertions(+), 49 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 6465db29bd..329a489b79 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -48,6 +48,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static Object rslock = new Object(); + private OpenSimBase m_app; private BaseHttpServer m_httpd; private IConfig m_config; @@ -186,6 +188,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: Restart Region request complete"); return response; } @@ -194,6 +197,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); + m_log.Info("[RADMIN]: Alert request started"); + try { Hashtable requestData = (Hashtable) request.Params[0]; @@ -230,6 +235,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: Alert request complete"); return response; } @@ -238,6 +244,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); + m_log.Info("[RADMIN]: Load height maps request started"); + try { Hashtable requestData = (Hashtable) request.Params[0]; @@ -283,12 +291,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController responseData["error"] = e.Message; } + m_log.Info("[RADMIN]: Load height maps request complete"); + return response; } public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request) { + m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); + XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); @@ -347,6 +359,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: Shutdown Administrator Request complete"); return response; } @@ -433,7 +446,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); - lock (this) + lock (rslock) { int m_regionLimit = m_config.GetInt("region_limit", 0); @@ -605,6 +618,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: CreateRegion: request complete"); return response; } } @@ -641,7 +655,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); - lock (this) + lock (rslock) { try { @@ -671,6 +685,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: DeleteRegion: request complete"); return response; } } @@ -719,7 +734,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); - lock (this) + lock (rslock) { try { @@ -779,6 +794,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: CreateUser: request complete"); return response; } } @@ -852,6 +868,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: UserExists: request complete"); return response; } @@ -899,7 +916,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); - lock (this) + lock (rslock) { try { @@ -1002,6 +1019,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController } } + m_log.Info("[RADMIN]: UpdateUserAccount: request complete"); return response; } @@ -1043,7 +1061,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); - lock (this) + lock (rslock) { try { @@ -1099,6 +1117,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: Load OAR Administrator Request complete"); return response; } } @@ -1195,6 +1214,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: Save OAR Administrator Request complete"); return response; } @@ -1204,7 +1224,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController XmlRpcResponse response = new XmlRpcResponse(); Hashtable responseData = new Hashtable(); - lock (this) + lock (rslock) { try { @@ -1277,6 +1297,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: Load XML Administrator Request complete"); return response; } } @@ -1360,6 +1381,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: Save XML Administrator Request complete"); return response; } @@ -1415,6 +1437,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController response.Value = responseData; } + m_log.Info("[RADMIN]: Query XML Administrator Request complete"); return response; } @@ -1422,4 +1445,4 @@ namespace OpenSim.ApplicationPlugins.RemoteController { } } -} \ No newline at end of file +} diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs index 8ab9fd23a1..62e18c4aa5 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs @@ -69,11 +69,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory internal static IRestHandler Plugin = null; internal static OpenSimBase main = null; - internal static CommunicationsManager Comms = null; - internal static IInventoryServices InventoryServices = null; - internal static IUserService UserServices = null; - internal static IAvatarService AvatarServices = null; - internal static IAssetCache AssetServices = null; internal static string Prefix = null; internal static IConfig Config = null; internal static string GodKey = null; @@ -87,6 +82,39 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory internal static string Scheme = AS_BASIC; internal static int DumpLineSize = 32; // Should be a multiple of 16 or (possibly) 4 + /// + /// These are all dependent upon the Comms manager + /// being initialized. So they have to be properties + /// because the comms manager is now a module and is + /// not guaranteed to be there when the rest handler + /// initializes. + /// + + internal static CommunicationsManager Comms + { + get { return main.CommunicationsManager; } + } + + internal static IInventoryServices InventoryServices + { + get { return Comms.InventoryService; } + } + + internal static IUserService UserServices + { + get { return Comms.UserService; } + } + + internal static IAvatarService AvatarServices + { + get { return Comms.AvatarService; } + } + + internal static IAssetCache AssetServices + { + get { return Comms.AssetCache; } + } + /// /// HTTP requires that status information be generated for PUT /// and POST opertaions. This is in support of that. The diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs index 667cf5750c..fad0438a5e 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs @@ -55,16 +55,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory Rest.Log.InfoFormat("{0} User appearance services initializing", MsgId); Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); - // This is better than a null reference. - - if (Rest.AvatarServices == null) - throw new Exception(String.Format("{0} OpenSim inventory services are not available", - MsgId)); - - if (Rest.UserServices == null) - throw new Exception(String.Format("{0} OpenSim user profile services are not available", - MsgId)); - // If a relative path was specified for the handler's domain, // add the standard prefix to make it absolute, e.g. /admin diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index 3475d3237b..043fca83fd 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs @@ -46,12 +46,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory Rest.Log.InfoFormat("{0} Asset services initializing", MsgId); Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); - // This is better than a null reference. - - if (Rest.AssetServices == null) - throw new Exception(String.Format("{0} OpenSim asset services are not available", - MsgId)); - // If the handler specifies a relative path for its domain // then we must add the standard absolute prefix, e.g. /admin diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs index f0a53083c7..5ff9da3d39 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestHandler.cs @@ -227,16 +227,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // them easy to reach from anywhere in the assembly. Rest.main = openSim; + if(Rest.main == null) + throw new Exception("OpenSim base pointer is null"); + Rest.Plugin = this; - Rest.Comms = Rest.main.CommunicationsManager; - Rest.UserServices = Rest.Comms.UserService; - Rest.InventoryServices = Rest.Comms.InventoryService; - Rest.AssetServices = Rest.Comms.AssetCache; - Rest.AvatarServices = Rest.Comms.AvatarService; Rest.Config = Config; Rest.Prefix = Prefix; Rest.GodKey = GodKey; - Rest.Authenticate = Rest.Config.GetBoolean("authenticate", Rest.Authenticate); Rest.Scheme = Rest.Config.GetString("auth-scheme", Rest.Scheme); Rest.Secure = Rest.Config.GetBoolean("secured", Rest.Secure); @@ -253,7 +250,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory (Rest.Authenticate ? "" : "not ")); Rest.Log.InfoFormat("{0} Security is {1}enabled", MsgId, - (Rest.Authenticate ? "" : "not ")); + (Rest.Secure ? "" : "not ")); Rest.Log.InfoFormat("{0} Extended URI escape processing is {1}enabled", MsgId, (Rest.ExtendedEscape ? "" : "not ")); diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 99350461a5..95e3d71d0a 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -62,20 +62,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory Rest.Log.InfoFormat("{0} Inventory services initializing", MsgId); Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); - // This is better than a null reference. - - if (Rest.InventoryServices == null) - throw new Exception(String.Format("{0} OpenSim inventory services are not available", - MsgId)); - - if (Rest.UserServices == null) - throw new Exception(String.Format("{0} OpenSim user services are not available", - MsgId)); - - if (Rest.AssetServices == null) - throw new Exception(String.Format("{0} OpenSim asset services are not available", - MsgId)); - // If a relative path was specified for the handler's domain, // add the standard prefix to make it absolute, e.g. /admin