From 5e4fc6e91e5edffd1dc23af4f583d6294f394a3d Mon Sep 17 00:00:00 2001 From: diva Date: Fri, 15 May 2009 05:00:25 +0000 Subject: Heart surgery on asset service code bits. Affects OpenSim.ini configuration -- please see the example. Affects region servers only. This may break a lot of things, but it needs to go in. It was tested in standalone and the UCI grid, but it needs a lot more testing. Known problems: * HG asset transfers are borked for now * missing texture is missing * 3 unit tests commented out for now --- .../ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 5 +++-- OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs | 6 ++++-- .../ApplicationPlugins/Rest/Inventory/RestAssetServices.cs | 12 +++++------- .../Rest/Inventory/RestInventoryServices.cs | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'OpenSim/ApplicationPlugins') diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index e499f64..9a25faa 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -47,6 +47,7 @@ using OpenSim.Framework.Servers.HttpServer; using OpenSim.Region.CoreModules.World.Terrain; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; +using OpenSim.Services.Interfaces; namespace OpenSim.ApplicationPlugins.RemoteController { @@ -1421,7 +1422,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController UICallback uic; IInventoryServices iserv = m_app.CommunicationsManager.InventoryService; - IAssetCache aserv = m_app.CommunicationsManager.AssetCache; + IAssetService aserv = m_app.SceneManager.CurrentOrFirstScene.AssetService; doc.LoadXml(File.ReadAllText(dafn)); @@ -1437,7 +1438,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController rass.Local = Boolean.Parse(GetStringAttribute(asset,"local","")); rass.Temporary = Boolean.Parse(GetStringAttribute(asset,"temporary","")); rass.Data = Convert.FromBase64String(asset.InnerText); - aserv.AddAsset(rass); + aserv.Store(rass); } avatars = doc.GetElementsByTagName("Avatar"); diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs index 748f20a..5d58c6a 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/Rest.cs @@ -34,6 +34,8 @@ using log4net; using Nini.Config; using OpenSim.Framework; using OpenSim.Framework.Communications; +using OpenSim.Services.Interfaces; +using IUserService = OpenSim.Framework.Communications.IUserService; namespace OpenSim.ApplicationPlugins.Rest.Inventory { @@ -110,9 +112,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory get { return Comms.AvatarService; } } - internal static IAssetCache AssetServices + internal static IAssetService AssetServices { - get { return Comms.AssetCache; } + get { return main.SceneManager.CurrentOrFirstScene.AssetService; } } /// diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs index 77c14c6..cd2074a 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAssetServices.cs @@ -190,14 +190,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory private void DoGet(AssetRequestData rdata) { - bool istexture = false; - Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method); if (rdata.Parameters.Length == 1) { UUID uuid = new UUID(rdata.Parameters[0]); - AssetBase asset = Rest.AssetServices.GetAsset(uuid, istexture); + AssetBase asset = Rest.AssetServices.Get(uuid.ToString()); if (asset != null) { @@ -258,7 +256,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory } UUID uuid = new UUID(rdata.Parameters[0]); - asset = Rest.AssetServices.GetAsset(uuid, false); + asset = Rest.AssetServices.Get(uuid.ToString()); modified = (asset != null); created = !modified; @@ -278,7 +276,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory MsgId, rdata.Parameters[0], asset.ID); } - Rest.AssetServices.AddAsset(asset); + Rest.AssetServices.Store(asset); } else @@ -338,7 +336,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory } UUID uuid = new UUID(xml.GetAttribute("id")); - AssetBase asset = Rest.AssetServices.GetAsset(uuid, false); + AssetBase asset = Rest.AssetServices.Get(uuid.ToString()); modified = (asset != null); created = !modified; @@ -352,7 +350,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory asset.Temporary = Int32.Parse(xml.GetAttribute("temporary")) != 0; asset.Data = Convert.FromBase64String(xml.ReadElementContentAsString("Asset", "")); - Rest.AssetServices.AddAsset(asset); + Rest.AssetServices.Store(asset); if (created) { diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs index 5de44b6..1a330b1 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestInventoryServices.cs @@ -476,7 +476,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory { Rest.Log.DebugFormat("{0} Rest asset: {1} {2} {3}", MsgId, asset.ID, asset.Type, asset.Name); - Rest.AssetServices.AddAsset(asset); + Rest.AssetServices.Store(asset); created = true; rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", @@ -682,7 +682,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // The asset was validated during the collection process - Rest.AssetServices.AddAsset(asset); + Rest.AssetServices.Store(asset); created = true; rdata.appendStatus(String.Format("

Created asset {0}, UUID {1}

", asset.Name, asset.ID)); -- cgit v1.1