Load default assets when AssetInventory starts.

GenericGridServerConcept
Mike Mazur 2009-02-23 04:39:08 +00:00
parent 05bbfd57f1
commit dba8c90611
4 changed files with 20 additions and 0 deletions

View File

@ -71,6 +71,7 @@ namespace OpenSim.Grid.AssetInventoryServer
{ {
IConfig config = result.AddConfig("Config"); IConfig config = result.AddConfig("Config");
config.Set("listen_port", 8003); config.Set("listen_port", 8003);
config.Set("assetset_location", String.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar));
} }
{ {

View File

@ -31,6 +31,7 @@ using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.AssetLoader.Filesystem;
using Nini.Config; using Nini.Config;
using log4net; using log4net;
@ -96,6 +97,8 @@ namespace OpenSim.Grid.AssetInventoryServer
return false; return false;
} }
LoadDefaultAssets();
AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider", AuthenticationProvider = LoadAssetInventoryServerPlugin("/OpenSim/AssetInventoryServer/AuthenticationProvider",
"authentication_provider", false) as IAuthenticationProvider; "authentication_provider", false) as IAuthenticationProvider;
m_backends.Add(AuthenticationProvider); m_backends.Add(AuthenticationProvider);
@ -197,5 +200,16 @@ namespace OpenSim.Grid.AssetInventoryServer
return loader.Plugins; 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);
}
} }
} }

View File

@ -3,6 +3,10 @@
; The port number for the asset server to listen on. ; The port number for the asset server to listen on.
listen_port = 8003 listen_port = 8003
; Points to an XML file which describes assets to load on startup.
; This is "./assets/AssetSets.xml" by default and can be changed below.
;assetset_location = ./assets/AssetSets.xml
[Plugins] [Plugins]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -768,6 +768,7 @@
<Reference name="OpenSim.Framework"/> <Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Servers"/> <Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Console"/> <Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.AssetLoader.Filesystem"/>
<Reference name="Nini.dll" /> <Reference name="Nini.dll" />
<Reference name="log4net"/> <Reference name="log4net"/>