From f2ff6d5186420ed4bbf7379ad6dc92f46b7907a9 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 20:31:46 +0000 Subject: Move asset commands from AssetService to AssetServerConnector so that we can harmonise the same commands on the simulator side. No functional change. --- OpenSim/Services/AssetService/AssetService.cs | 124 +------------------------- 1 file changed, 3 insertions(+), 121 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index b3af8e3..4f4cbf6 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -32,7 +32,6 @@ using System.Reflection; using Nini.Config; using log4net; using OpenSim.Framework; -using OpenSim.Framework.Console; using OpenSim.Data; using OpenSim.Services.Interfaces; using OpenMetaverse; @@ -53,23 +52,6 @@ namespace OpenSim.Services.AssetService { m_RootInstance = this; - MainConsole.Instance.Commands.AddCommand("kfs", false, - "show digest", - "show digest ", - "Show asset digest", HandleShowDigest); - - MainConsole.Instance.Commands.AddCommand("kfs", false, - "delete asset", - "delete asset ", - "Delete asset from database", HandleDeleteAsset); - - MainConsole.Instance.Commands.AddCommand("kfs", false, - "dump asset", - "dump asset ", - "Dump asset to a file", - "The filename is the same as the ID given.", - HandleDumpAsset); - if (m_AssetLoader != null) { IConfig assetConfig = config.Configs["AssetService"]; @@ -218,111 +200,11 @@ namespace OpenSim.Services.AssetService return m_Database.Delete(id); } else - m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id); - - return false; - } - - void HandleDumpAsset(string module, string[] args) - { - if (args.Length < 3) - { - MainConsole.Instance.Output("Usage is dump asset "); - return; - } - - string rawAssetId = args[2]; - UUID assetId; - - if (!UUID.TryParse(rawAssetId, out assetId)) - { - MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId); - return; - } - - AssetBase asset = m_Database.GetAsset(assetId); - if (asset == null) - { - MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId); - return; - } - - string fileName = rawAssetId; - - using (FileStream fs = new FileStream(fileName, FileMode.CreateNew)) - { - using (BinaryWriter bw = new BinaryWriter(fs)) - { - bw.Write(asset.Data); - } - } - - MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName); - } - - void HandleShowDigest(string module, string[] args) - { - if (args.Length < 3) - { - MainConsole.Instance.Output("Syntax: show digest "); - return; - } - - AssetBase asset = Get(args[2]); - - if (asset == null || asset.Data.Length == 0) - { - MainConsole.Instance.Output("Asset not found"); - return; - } - - int i; - - MainConsole.Instance.OutputFormat("Name: {0}", asset.Name); - MainConsole.Instance.OutputFormat("Description: {0}", asset.Description); - MainConsole.Instance.OutputFormat("Type: {0} (type number = {1})", (AssetType)asset.Type, asset.Type); - MainConsole.Instance.OutputFormat("Content-type: {0}", asset.Metadata.ContentType); - MainConsole.Instance.OutputFormat("Flags: {0}", asset.Metadata.Flags); - - for (i = 0 ; i < 5 ; i++) { - int off = i * 16; - if (asset.Data.Length <= off) - break; - int len = 16; - if (asset.Data.Length < off + len) - len = asset.Data.Length - off; - - byte[] line = new byte[len]; - Array.Copy(asset.Data, off, line, 0, len); - - string text = BitConverter.ToString(line); - MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text)); - } - } - - void HandleDeleteAsset(string module, string[] args) - { - if (args.Length < 3) - { - MainConsole.Instance.Output("Syntax: delete asset "); - return; - } - - AssetBase asset = Get(args[2]); - - if (asset == null || asset.Data.Length == 0) - { - MainConsole.Instance.Output("Asset not found"); - return; + m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id); } - Delete(args[2]); - - //MainConsole.Instance.Output("Asset deleted"); - // TODO: Implement this - - MainConsole.Instance.Output("Asset deletion not supported by database"); + return false; } } -} +} \ No newline at end of file -- cgit v1.1 From 7319ba62dd1791a3dade5b5453e369d955de48a2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 5 Jan 2012 20:51:49 +0000 Subject: Move simulator asset info commands to an optional module from the connector. Make them conform with service side commands. This stops them appearing twice when Hypergrid is enabled. --- .../Connectors/Asset/AssetServiceConnector.cs | 45 +--------------------- 1 file changed, 2 insertions(+), 43 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index d7b2ff8..e4c3eaf 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs @@ -86,11 +86,8 @@ namespace OpenSim.Services.Connectors m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); throw new Exception("Asset connector init error"); } - m_ServerURI = serviceURI; - MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset", - "dump asset ", - "dump one cached asset", HandleDumpAsset); + m_ServerURI = serviceURI; } protected void SetCache(IImprovedAssetCache cache) @@ -328,43 +325,5 @@ namespace OpenSim.Services.Connectors } return false; } - - private void HandleDumpAsset(string module, string[] args) - { - if (args.Length != 4) - { - MainConsole.Instance.Output("Syntax: dump asset "); - return; - } - - UUID assetID; - - if (!UUID.TryParse(args[2], out assetID)) - { - MainConsole.Instance.Output("Invalid asset ID"); - return; - } - - if (m_Cache == null) - { - MainConsole.Instance.Output("Instance uses no cache"); - return; - } - - AssetBase asset = m_Cache.Get(assetID.ToString()); - - if (asset == null) - { - MainConsole.Instance.Output("Asset not found in cache"); - return; - } - - string fileName = args[3]; - - FileStream fs = File.Create(fileName); - fs.Write(asset.Data, 0, asset.Data.Length); - - fs.Close(); - } } -} +} \ No newline at end of file -- cgit v1.1 From f4231f06283dedc4ee9e898f969700d991575558 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 7 Jan 2012 00:32:32 +0000 Subject: minor: remove mono compiler warning --- OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs index c030bca..5c50936 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs @@ -66,7 +66,7 @@ namespace OpenSim.Services.Connectors m_ServerURI = m_ServerURI.TrimEnd('/') + "/helo/"; } } - catch (UriFormatException e) + catch (UriFormatException) { m_log.WarnFormat("[HELO SERVICE]: Malformed URL {0}", serverURI); } -- cgit v1.1 From 8bdd80abfa3830142b16615d97d555dad417e08d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 12 Jan 2012 09:56:35 -0800 Subject: HG: normalize all externalized user ULRs to be the Home URL, i.e. the location of the user's UAS. This corrects an earlier design which had some cases pointing to the profile server. WARNING: CONFIGURATION CHANGES in both the sims (*Common.ini) and the Robust configs (Robust.HG.ini). Please check diff of the example files, but basically all vars that were pointing to profile should point to the UAS instead and should be called HomeURI. --- OpenSim/Services/HypergridService/HGAssetService.cs | 11 +++++++---- OpenSim/Services/HypergridService/HGInventoryService.cs | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index e518329..22e233a 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs @@ -53,7 +53,7 @@ namespace OpenSim.Services.HypergridService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); - private string m_ProfileServiceURL; + private string m_HomeURL; private IUserAccountService m_UserAccountService; private UserAccountCache m_Cache; @@ -74,7 +74,10 @@ namespace OpenSim.Services.HypergridService if (m_UserAccountService == null) throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); - m_ProfileServiceURL = assetConfig.GetString("ProfileServerURI", string.Empty); + // legacy configuration [obsolete] + m_HomeURL = assetConfig.GetString("ProfileServerURI", string.Empty); + // Preferred + m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); } @@ -134,13 +137,13 @@ namespace OpenSim.Services.HypergridService UserAccount creator = m_Cache.GetUser(meta.CreatorID); if (creator != null) - meta.CreatorID = m_ProfileServiceURL + "/" + meta.CreatorID + ";" + creator.FirstName + " " + creator.LastName; + meta.CreatorID = meta.CreatorID + ";" + m_HomeURL + "/" + creator.FirstName + " " + creator.LastName; } protected byte[] AdjustIdentifiers(byte[] data) { string xml = Utils.BytesToString(data); - return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, m_ProfileServiceURL, m_Cache, UUID.Zero)); + return Utils.StringToBytes(ExternalRepresentationUtils.RewriteSOP(xml, m_HomeURL, m_Cache, UUID.Zero)); } } diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 4eb61ba..daf8c3a 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs @@ -55,7 +55,7 @@ namespace OpenSim.Services.HypergridService protected new IXInventoryData m_Database; - private string m_ProfileServiceURL; + private string m_HomeURL; private IUserAccountService m_UserAccountService; private UserAccountCache m_Cache; @@ -100,7 +100,10 @@ namespace OpenSim.Services.HypergridService if (m_UserAccountService == null) throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); - m_ProfileServiceURL = invConfig.GetString("ProfileServerURI", string.Empty); + // legacy configuration [obsolete] + m_HomeURL = invConfig.GetString("ProfileServerURI", string.Empty); + // Preferred + m_HomeURL = invConfig.GetString("HomeURI", m_HomeURL); m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); } @@ -321,7 +324,7 @@ namespace OpenSim.Services.HypergridService // Adjust the creator data if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty)) - it.CreatorData = m_ProfileServiceURL + "/" + it.CreatorId + ";" + user.FirstName + " " + user.LastName; + it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName; return it; } -- cgit v1.1 From e13a17cc0c8514bc673d5ba39c86d23451278389 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 16 Jan 2012 02:19:19 +0100 Subject: Allow retrival of multiple user records in one operation, analog to presence --- .../GridUser/GridUserServiceConnector.cs | 60 ++++++++++++++++++++++ .../SimianGrid/SimianPresenceServiceConnector.cs | 4 ++ OpenSim/Services/Interfaces/IGridUserService.cs | 3 +- .../Services/UserAccountService/GridUserService.cs | 12 ++++- 4 files changed, 77 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs index 738cc06..aa98b5d 100644 --- a/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs +++ b/OpenSim/Services/Connectors/GridUser/GridUserServiceConnector.cs @@ -223,5 +223,65 @@ namespace OpenSim.Services.Connectors } + public GridUserInfo[] GetGridUserInfo(string[] userIDs) + { + Dictionary sendData = new Dictionary(); + //sendData["SCOPEID"] = scopeID.ToString(); + sendData["VERSIONMIN"] = ProtocolVersions.ClientProtocolVersionMin.ToString(); + sendData["VERSIONMAX"] = ProtocolVersions.ClientProtocolVersionMax.ToString(); + sendData["METHOD"] = "getgriduserinfos"; + + sendData["AgentIDs"] = new List(userIDs); + + string reply = string.Empty; + string reqString = ServerUtils.BuildQueryString(sendData); + //m_log.DebugFormat("[PRESENCE CONNECTOR]: queryString = {0}", reqString); + try + { + reply = SynchronousRestFormsRequester.MakeRequest("POST", + m_ServerURI + "/griduser", + reqString); + if (reply == null || (reply != null && reply == string.Empty)) + { + m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null or empty reply"); + return null; + } + } + catch (Exception e) + { + m_log.DebugFormat("[GRID USER CONNECTOR]: Exception when contacting grid user server: {0}", e.Message); + } + + List rinfos = new List(); + + Dictionary replyData = ServerUtils.ParseXmlResponse(reply); + + if (replyData != null) + { + if (replyData.ContainsKey("result") && + (replyData["result"].ToString() == "null" || replyData["result"].ToString() == "Failure")) + { + return new GridUserInfo[0]; + } + + Dictionary.ValueCollection pinfosList = replyData.Values; + //m_log.DebugFormat("[PRESENCE CONNECTOR]: GetAgents returned {0} elements", pinfosList.Count); + foreach (object griduser in pinfosList) + { + if (griduser is Dictionary) + { + GridUserInfo pinfo = new GridUserInfo((Dictionary)griduser); + rinfos.Add(pinfo); + } + else + m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received invalid response type {0}", + griduser.GetType()); + } + } + else + m_log.DebugFormat("[GRID USER CONNECTOR]: GetGridUserInfo received null response"); + + return rinfos.ToArray(); + } } } diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 678f738..ca1b64f 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -472,6 +472,10 @@ namespace OpenSim.Services.Connectors.SimianGrid return false; } + public GridUserInfo[] GetGridUserInfo(string[] userIDs) + { + return new GridUserInfo[0]; + } #endregion Helpers } } diff --git a/OpenSim/Services/Interfaces/IGridUserService.cs b/OpenSim/Services/Interfaces/IGridUserService.cs index 6613ae7..0a52bfa 100644 --- a/OpenSim/Services/Interfaces/IGridUserService.cs +++ b/OpenSim/Services/Interfaces/IGridUserService.cs @@ -131,5 +131,6 @@ namespace OpenSim.Services.Interfaces bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 lastPosition, Vector3 lastLookAt); GridUserInfo GetGridUserInfo(string userID); + GridUserInfo[] GetGridUserInfo(string[] userID); } -} \ No newline at end of file +} diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index 9b18915..ac3d8fd 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs @@ -73,6 +73,16 @@ namespace OpenSim.Services.UserAccountService return info; } + public GridUserInfo[] GetGridUserInfo(string[] userIDs) + { + List ret = new List(); + + foreach (string id in userIDs) + ret.Add(GetGridUserInfo(id)); + + return ret.ToArray(); + } + public GridUserInfo LoggedIn(string userID) { m_log.DebugFormat("[GRID USER SERVICE]: User {0} is online", userID); @@ -156,4 +166,4 @@ namespace OpenSim.Services.UserAccountService return m_Database.Store(d); } } -} \ No newline at end of file +} -- cgit v1.1 From 91ac21b9ec36d698bfaa7ecf6e8d981562ddb4c1 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 26 Jan 2012 17:00:58 -0800 Subject: HG Inventoty: Guard against items not found. --- OpenSim/Services/HypergridService/HGInventoryService.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index daf8c3a..41d5a7a 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs @@ -319,13 +319,14 @@ namespace OpenSim.Services.HypergridService public override InventoryItemBase GetItem(InventoryItemBase item) { InventoryItemBase it = base.GetItem(item); + if (it != null) + { + UserAccount user = m_Cache.GetUser(it.CreatorId); - UserAccount user = m_Cache.GetUser(it.CreatorId); - - // Adjust the creator data - if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty)) - it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName; - + // Adjust the creator data + if (user != null && it != null && (it.CreatorData == null || it.CreatorData == string.Empty)) + it.CreatorData = m_HomeURL + ";" + user.FirstName + " " + user.LastName; + } return it; } -- cgit v1.1 From bde2ff5e78360061be89e4c5717f4d67248d9185 Mon Sep 17 00:00:00 2001 From: Melanie Date: Mon, 30 Jan 2012 20:11:47 +0000 Subject: Next step for world map overlays --- OpenSim/Services/Interfaces/IGridService.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 7137f9a..d809996 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -190,6 +190,7 @@ namespace OpenSim.Services.Interfaces public UUID ScopeID = UUID.Zero; public UUID TerrainImage = UUID.Zero; + public UUID ParcelImage = UUID.Zero; public byte Access; public int Maturity; public string RegionSecret = string.Empty; @@ -236,6 +237,7 @@ namespace OpenSim.Services.Interfaces RegionID = ConvertFrom.RegionID; ServerURI = ConvertFrom.ServerURI; TerrainImage = ConvertFrom.RegionSettings.TerrainImageID; + ParcelImage = ConvertFrom.RegionSettings.ParcelImageID; Access = ConvertFrom.AccessLevel; Maturity = ConvertFrom.RegionSettings.Maturity; RegionSecret = ConvertFrom.regionSecret; @@ -253,6 +255,7 @@ namespace OpenSim.Services.Interfaces RegionID = ConvertFrom.RegionID; ServerURI = ConvertFrom.ServerURI; TerrainImage = ConvertFrom.TerrainImage; + ParcelImage = ConvertFrom.ParcelImage; Access = ConvertFrom.Access; Maturity = ConvertFrom.Maturity; RegionSecret = ConvertFrom.RegionSecret; @@ -281,7 +284,7 @@ namespace OpenSim.Services.Interfaces public override int GetHashCode() { - return RegionID.GetHashCode() ^ TerrainImage.GetHashCode(); + return RegionID.GetHashCode() ^ TerrainImage.GetHashCode() ^ ParcelImage.GetHashCode(); } #endregion @@ -359,6 +362,7 @@ namespace OpenSim.Services.Interfaces kvp["serverURI"] = ServerURI; kvp["serverPort"] = InternalEndPoint.Port.ToString(); kvp["regionMapTexture"] = TerrainImage.ToString(); + kvp["parcelMapTexture"] = ParcelImage.ToString(); kvp["access"] = Access.ToString(); kvp["regionSecret"] = RegionSecret; kvp["owner_uuid"] = EstateOwner.ToString(); @@ -411,6 +415,9 @@ namespace OpenSim.Services.Interfaces if (kvp.ContainsKey("regionMapTexture")) UUID.TryParse((string)kvp["regionMapTexture"], out TerrainImage); + if (kvp.ContainsKey("parcelMapTexture")) + UUID.TryParse((string)kvp["parcelMapTexture"], out ParcelImage); + if (kvp.ContainsKey("access")) Access = Byte.Parse((string)kvp["access"]); -- cgit v1.1