From dba8c90611abf50b706bc3ba54bc455ee142dae3 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Mon, 23 Feb 2009 04:39:08 +0000 Subject: Load default assets when AssetInventory starts. --- OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs | 1 + OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) (limited to 'OpenSim') diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs index d0f4250..79b6c73 100644 --- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs +++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryConfig.cs @@ -71,6 +71,7 @@ namespace OpenSim.Grid.AssetInventoryServer { IConfig config = result.AddConfig("Config"); config.Set("listen_port", 8003); + config.Set("assetset_location", String.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar)); } { diff --git a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs index 74e6ea4..2687af6 100644 --- a/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs +++ b/OpenSim/Grid/AssetInventoryServer/AssetInventoryServer.cs @@ -31,6 +31,7 @@ using System.Reflection; using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Console; +using OpenSim.Framework.AssetLoader.Filesystem; using Nini.Config; using log4net; @@ -96,6 +97,8 @@ namespace OpenSim.Grid.AssetInventoryServer return false; } + LoadDefaultAssets(); + AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", "authentication_provider", false) as IAuthenticationProvider; m_backends.Add(AuthenticationProvider); @@ -197,5 +200,16 @@ namespace OpenSim.Grid.AssetInventoryServer return loader.Plugins; } + + private void LoadDefaultAssets() + { + AssetLoaderFileSystem assetLoader = new AssetLoaderFileSystem(); + assetLoader.ForEachDefaultXmlAsset(ConfigFile.Configs["Config"].GetString("assetset_location"), StoreAsset); + } + + private void StoreAsset(AssetBase asset) + { + StorageProvider.TryCreateAsset(asset); + } } } -- cgit v1.1