From ae4b02e1152b775dc1cdccd1abfbff44ab1a8949 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 25 Nov 2010 11:14:16 -0800 Subject: WARNING: LOTS OF CONFIGURATION CHANGES AFFECTING PRIMARILY HG CONFIGS. Added capability to preserve creator information on HG asset transfers. Added a new HGAssetService that is intended to be the one outside the firewall. It processes and filters the assets that go out of the grid. Also fixed the normal AssetService to do special things for the main instance (console commands, etc). Moved HGInventoryService to OpenSim.Services.HypergridService. Changed the way the login service gets the ServiceURL configs. --- OpenSim/Services/AssetService/AssetService.cs | 73 +++++++++++++++------------ 1 file changed, 40 insertions(+), 33 deletions(-) (limited to 'OpenSim/Services/AssetService') diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 470a4dd..3fd2fcf 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -43,44 +43,51 @@ namespace OpenSim.Services.AssetService LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); + protected static AssetService m_RootInstance; + public AssetService(IConfigSource config) : base(config) { - 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); - - if (m_AssetLoader != null) + if (m_RootInstance == null) { - IConfig assetConfig = config.Configs["AssetService"]; - if (assetConfig == null) - throw new Exception("No AssetService configuration"); + m_RootInstance = this; - string loaderArgs = assetConfig.GetString("AssetLoaderArgs", - String.Empty); + MainConsole.Instance.Commands.AddCommand("kfs", false, + "show digest", + "show digest ", + "Show asset digest", HandleShowDigest); - bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true); + MainConsole.Instance.Commands.AddCommand("kfs", false, + "delete asset", + "delete asset ", + "Delete asset from database", HandleDeleteAsset); - if (assetLoaderEnabled) + if (m_AssetLoader != null) { - m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); - m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs, - delegate(AssetBase a) - { - Store(a); - }); + IConfig assetConfig = config.Configs["AssetService"]; + if (assetConfig == null) + throw new Exception("No AssetService configuration"); + + string loaderArgs = assetConfig.GetString("AssetLoaderArgs", + String.Empty); + + bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true); + + if (assetLoaderEnabled) + { + m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs); + m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs, + delegate(AssetBase a) + { + Store(a); + }); + } + + m_log.Info("[ASSET SERVICE]: Local asset service enabled"); } - - m_log.Info("[ASSET SERVICE]: Local asset service enabled"); } } - public AssetBase Get(string id) + public virtual AssetBase Get(string id) { UUID assetID; @@ -93,12 +100,12 @@ namespace OpenSim.Services.AssetService return m_Database.GetAsset(assetID); } - public AssetBase GetCached(string id) + public virtual AssetBase GetCached(string id) { return Get(id); } - public AssetMetadata GetMetadata(string id) + public virtual AssetMetadata GetMetadata(string id) { UUID assetID; @@ -112,7 +119,7 @@ namespace OpenSim.Services.AssetService return null; } - public byte[] GetData(string id) + public virtual byte[] GetData(string id) { UUID assetID; @@ -123,7 +130,7 @@ namespace OpenSim.Services.AssetService return asset.Data; } - public bool Get(string id, Object sender, AssetRetrieved handler) + public virtual bool Get(string id, Object sender, AssetRetrieved handler) { //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); @@ -141,7 +148,7 @@ namespace OpenSim.Services.AssetService return true; } - public string Store(AssetBase asset) + public virtual string Store(AssetBase asset) { //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); m_Database.StoreAsset(asset); @@ -154,7 +161,7 @@ namespace OpenSim.Services.AssetService return false; } - public bool Delete(string id) + public virtual bool Delete(string id) { m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id); UUID assetID; -- cgit v1.1