* Apply http://opensimulator.org/mantis/view.php?id=2927 with some changes
* This allows configuration of the assetset and library control file paths to be other than ./inventory/Libraries.xml and ./assets/AssetSets.xml * This is controlled via the LibrariesXMLFile and AssetSetsXMLFile configuration settings in [StandAlone] in OpenSim.ini (in standalone) and via the user and asset config xml files for grid mode * Thanks to SirKimba for the patch0.6.2-post-fixes
parent
817a10d0aa
commit
266d0fbaae
|
@ -40,6 +40,7 @@ namespace OpenSim.Framework
|
|||
public string DatabaseConnect = String.Empty;
|
||||
public string DatabaseProvider = String.Empty;
|
||||
public uint HttpPort = DefaultHttpPort;
|
||||
public string AssetSetsLocation = string.Empty;
|
||||
|
||||
public AssetConfig(string description, string filename)
|
||||
{
|
||||
|
@ -58,6 +59,10 @@ namespace OpenSim.Framework
|
|||
|
||||
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||
"Http Listener port", DefaultHttpPort.ToString(), false);
|
||||
|
||||
configMember.addConfigurationOption("assetset_location", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Location of 'AssetSets.xml'",
|
||||
string.Format(".{0}assets{0}AssetSets.xml", System.IO.Path.DirectorySeparatorChar), false);
|
||||
}
|
||||
|
||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||
|
@ -70,6 +75,9 @@ namespace OpenSim.Framework
|
|||
case "database_connect":
|
||||
DatabaseConnect = (string) configuration_result;
|
||||
break;
|
||||
case "assetset_location":
|
||||
AssetSetsLocation = (string) configuration_result;
|
||||
break;
|
||||
case "http_port":
|
||||
HttpPort = (uint) configuration_result;
|
||||
break;
|
||||
|
|
|
@ -86,12 +86,6 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
|
|||
}
|
||||
}
|
||||
|
||||
public void ForEachDefaultXmlAsset(Action<AssetBase> action)
|
||||
{
|
||||
string assetSetFilename = Path.Combine(Util.assetsDir(), "AssetSets.xml");
|
||||
|
||||
ForEachDefaultXmlAsset(assetSetFilename, action);
|
||||
}
|
||||
|
||||
public void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action)
|
||||
{
|
||||
|
@ -99,16 +93,18 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
|
|||
if (File.Exists(assetSetFilename))
|
||||
{
|
||||
string assetSetPath = "ERROR";
|
||||
|
||||
string assetRootPath = "";
|
||||
try
|
||||
{
|
||||
XmlConfigSource source = new XmlConfigSource(assetSetFilename);
|
||||
assetRootPath = Path.GetFullPath(source.SavePath);
|
||||
assetRootPath = Path.GetDirectoryName(assetRootPath);
|
||||
|
||||
for (int i = 0; i < source.Configs.Count; i++)
|
||||
{
|
||||
assetSetPath = source.Configs[i].GetString("file", String.Empty);
|
||||
|
||||
LoadXmlAssetSet(Path.Combine(Util.assetsDir(), assetSetPath), assets);
|
||||
LoadXmlAssetSet(Path.Combine(assetRootPath, assetSetPath), assets);
|
||||
}
|
||||
}
|
||||
catch (XmlException e)
|
||||
|
@ -118,7 +114,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[ASSETS]: Asset set control file assets/AssetSets.xml does not exist! No assets loaded.");
|
||||
m_log.ErrorFormat("[ASSETS]: Asset set control file {0} does not exist! No assets loaded.", assetSetFilename);
|
||||
}
|
||||
|
||||
assets.ForEach(action);
|
||||
|
|
|
@ -106,11 +106,11 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
}
|
||||
|
||||
public virtual void LoadDefaultAssets()
|
||||
public virtual void LoadDefaultAssets(string pAssetSetsXml)
|
||||
{
|
||||
m_log.Info("[ASSET SERVER]: Setting up asset database");
|
||||
|
||||
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
||||
assetLoader.ForEachDefaultXmlAsset(pAssetSetsXml, StoreAsset);
|
||||
}
|
||||
|
||||
public AssetServerBase()
|
||||
|
|
|
@ -53,10 +53,8 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
protected Dictionary<UUID, InventoryFolderImpl> libraryFolders
|
||||
= new Dictionary<UUID, InventoryFolderImpl>();
|
||||
|
||||
public LibraryRootFolder()
|
||||
public LibraryRootFolder(string pLibrariesLocation)
|
||||
{
|
||||
m_log.Info("[LIBRARY INVENTORY]: Loading library inventory");
|
||||
|
||||
Owner = libOwner;
|
||||
ID = new UUID("00000112-000f-0000-0000-000100bba000");
|
||||
Name = "OpenSim Library";
|
||||
|
@ -66,7 +64,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
libraryFolders.Add(ID, this);
|
||||
|
||||
LoadLibraries(Path.Combine(Util.inventoryDir(), "Libraries.xml"));
|
||||
LoadLibraries(pLibrariesLocation);
|
||||
}
|
||||
|
||||
public InventoryItemBase CreateItem(UUID inventoryID, UUID assetID, string name, string description,
|
||||
|
@ -96,9 +94,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
/// <param name="assets"></param>
|
||||
protected void LoadLibraries(string librariesControlPath)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[LIBRARY INVENTORY]: Loading libraries control file {0}", librariesControlPath);
|
||||
|
||||
m_log.InfoFormat("[LIBRARY INVENTORY]: Loading library control file {0}", librariesControlPath);
|
||||
LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig);
|
||||
}
|
||||
|
||||
|
@ -106,17 +102,18 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
/// Read a library set from config
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
protected void ReadLibraryFromConfig(IConfig config)
|
||||
protected void ReadLibraryFromConfig(IConfig config, string path)
|
||||
{
|
||||
string basePath = Path.GetDirectoryName(path);
|
||||
string foldersPath
|
||||
= Path.Combine(
|
||||
Util.inventoryDir(), config.GetString("foldersFile", String.Empty));
|
||||
basePath, config.GetString("foldersFile", String.Empty));
|
||||
|
||||
LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig);
|
||||
|
||||
string itemsPath
|
||||
= Path.Combine(
|
||||
Util.inventoryDir(), config.GetString("itemsFile", String.Empty));
|
||||
basePath, config.GetString("itemsFile", String.Empty));
|
||||
|
||||
LoadFromFile(itemsPath, "Library items", ReadItemFromConfig);
|
||||
}
|
||||
|
@ -125,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
/// Read a library inventory folder from a loaded configuration
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
private void ReadFolderFromConfig(IConfig config)
|
||||
private void ReadFolderFromConfig(IConfig config, string path)
|
||||
{
|
||||
InventoryFolderImpl folderInfo = new InventoryFolderImpl();
|
||||
|
||||
|
@ -158,7 +155,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
/// Read a library inventory item metadata from a loaded configuration
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
private void ReadItemFromConfig(IConfig config)
|
||||
private void ReadItemFromConfig(IConfig config, string path)
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = libOwner;
|
||||
|
@ -195,7 +192,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
}
|
||||
|
||||
private delegate void ConfigAction(IConfig config);
|
||||
private delegate void ConfigAction(IConfig config, string path);
|
||||
|
||||
/// <summary>
|
||||
/// Load the given configuration at a path and perform an action on each Config contained within it
|
||||
|
@ -213,7 +210,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
for (int i = 0; i < source.Configs.Count; i++)
|
||||
{
|
||||
action(source.Configs[i]);
|
||||
action(source.Configs[i], path);
|
||||
}
|
||||
}
|
||||
catch (XmlException e)
|
||||
|
|
|
@ -179,5 +179,30 @@ namespace OpenSim.Framework
|
|||
get { return m_dumpAssetsToFile; }
|
||||
set { m_dumpAssetsToFile = value; }
|
||||
}
|
||||
|
||||
protected string m_librariesXMLFile;
|
||||
public string LibrariesXMLFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_librariesXMLFile;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_librariesXMLFile = value;
|
||||
}
|
||||
}
|
||||
protected string m_assetSetsXMLFile;
|
||||
public string AssetSetsXMLFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_assetSetsXMLFile;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_assetSetsXMLFile = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace OpenSim.Framework
|
|||
{
|
||||
public interface IAssetLoader
|
||||
{
|
||||
void ForEachDefaultXmlAsset(Action<AssetBase> action);
|
||||
void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action);
|
||||
}
|
||||
}
|
|
@ -47,6 +47,7 @@ namespace OpenSim.Framework
|
|||
public uint HttpPort = DefaultHttpPort;
|
||||
public bool HttpSSL = DefaultHttpSSL;
|
||||
public uint DefaultUserLevel = 0;
|
||||
public string LibraryXmlfile = "";
|
||||
|
||||
private Uri m_inventoryUrl;
|
||||
|
||||
|
@ -109,6 +110,11 @@ namespace OpenSim.Framework
|
|||
"Default Inventory Server URI",
|
||||
"http://127.0.0.1:" + InventoryConfig.DefaultHttpPort + "/",
|
||||
false);
|
||||
configMember.addConfigurationOption("library_location",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Path to library control file",
|
||||
string.Format(".{0}inventory{0}Libraries.xml", System.IO.Path.DirectorySeparatorChar), false);
|
||||
|
||||
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"DLL for database provider", "OpenSim.Data.MySQL.dll", false);
|
||||
configMember.addConfigurationOption("database_connect", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
|
@ -174,6 +180,9 @@ namespace OpenSim.Framework
|
|||
case "default_loginLevel":
|
||||
DefaultUserLevel = (uint)configuration_result;
|
||||
break;
|
||||
case "library_location":
|
||||
LibraryXmlfile = (string)configuration_result;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -87,8 +87,8 @@ namespace OpenSim.Grid.AssetServer
|
|||
m_log.Info("[ASSET]: Setting up asset DB");
|
||||
setupDB(config);
|
||||
|
||||
m_log.Info("[ASSET]: Loading default asset set..");
|
||||
LoadDefaultAssets();
|
||||
m_log.Info("[ASSET]: Loading default asset set from '" + config.AssetSetsLocation + "'");
|
||||
LoadDefaultAssets(config.AssetSetsLocation);
|
||||
|
||||
m_log.Info("[ASSET]: Starting HTTP process");
|
||||
m_httpServer = new BaseHttpServer(config.HttpPort);
|
||||
|
@ -142,9 +142,9 @@ namespace OpenSim.Grid.AssetServer
|
|||
}
|
||||
}
|
||||
|
||||
public void LoadDefaultAssets()
|
||||
public void LoadDefaultAssets(string pAssetSetsLocation)
|
||||
{
|
||||
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
||||
assetLoader.ForEachDefaultXmlAsset(pAssetSetsLocation, StoreAsset);
|
||||
}
|
||||
|
||||
protected void StoreAsset(AssetBase asset)
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace OpenSim.Grid.UserServer
|
|||
protected virtual void StartupLoginService(IInterServiceInventoryServices inventoryService)
|
||||
{
|
||||
m_loginService = new UserLoginService(
|
||||
m_userManager, inventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
|
||||
m_userManager, inventoryService, new LibraryRootFolder(Cfg.LibraryXmlfile), Cfg, Cfg.DefaultStartupMsg);
|
||||
}
|
||||
|
||||
protected virtual void AddHttpHandlers()
|
||||
|
|
|
@ -44,7 +44,6 @@ namespace OpenSim
|
|||
|
||||
public ConfigurationLoader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public OpenSimConfigSource LoadConfigSettings(IConfigSource configSource, out ConfigSettings configSettings, out NetworkServersInfo networkInfo)
|
||||
|
@ -150,6 +149,8 @@ namespace OpenSim
|
|||
config.Set("user_source", "");
|
||||
config.Set("asset_plugin", "OpenSim.Data.SQLite.dll");
|
||||
config.Set("asset_source", "");
|
||||
config.Set("LibrariesXMLFile", string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar));
|
||||
config.Set("AssetSetsXMLFile", string.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar));
|
||||
config.Set("dump_assets_to_file", false);
|
||||
}
|
||||
|
||||
|
@ -186,7 +187,6 @@ namespace OpenSim
|
|||
m_configSettings.Standalone = !startupConfig.GetBoolean("gridmode", false);
|
||||
m_configSettings.PhysicsEngine = startupConfig.GetString("physics");
|
||||
m_configSettings.MeshEngineName = startupConfig.GetString("meshing");
|
||||
|
||||
m_configSettings.PhysicalPrim = startupConfig.GetBoolean("physical_prim", true);
|
||||
|
||||
m_configSettings.See_into_region_from_neighbor = startupConfig.GetBoolean("see_into_this_sim_from_neighbor", true);
|
||||
|
@ -218,6 +218,9 @@ namespace OpenSim
|
|||
m_configSettings.StandaloneAssetPlugin = standaloneConfig.GetString("asset_plugin");
|
||||
m_configSettings.StandaloneAssetSource = standaloneConfig.GetString("asset_source");
|
||||
|
||||
m_configSettings.LibrariesXMLFile = standaloneConfig.GetString("LibrariesXMLFile");
|
||||
m_configSettings.AssetSetsXMLFile = standaloneConfig.GetString("AssetSetsXMLFile");
|
||||
|
||||
m_configSettings.DumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ namespace OpenSim
|
|||
|
||||
m_stats = StatsManager.StartCollectingSimExtraStats();
|
||||
|
||||
LibraryRootFolder libraryRootFolder = new LibraryRootFolder();
|
||||
LibraryRootFolder libraryRootFolder = new LibraryRootFolder(m_configSettings.LibrariesXMLFile);
|
||||
|
||||
// StandAlone mode? is determined by !startupConfig.GetBoolean("gridmode", false)
|
||||
if (m_configSettings.Standalone)
|
||||
|
@ -291,7 +291,7 @@ namespace OpenSim
|
|||
else
|
||||
{
|
||||
SQLAssetServer sqlAssetServer = new SQLAssetServer(m_configSettings.StandaloneAssetPlugin, m_configSettings.StandaloneAssetSource);
|
||||
sqlAssetServer.LoadDefaultAssets();
|
||||
sqlAssetServer.LoadDefaultAssets(m_configSettings.AssetSetsXMLFile);
|
||||
assetServer = sqlAssetServer;
|
||||
}
|
||||
|
||||
|
|
|
@ -225,6 +225,14 @@
|
|||
; User Source MySQL example
|
||||
;user_source = "Data Source=localhost;Database=opensim;User ID=opensim;Password=****;"
|
||||
|
||||
; Specifies the location and filename of the default inventory library control file. The path can be relative or absolute
|
||||
; Default is ./inventory/Libraries.xml
|
||||
;LibrariesXMLFile="./inventory/Libraries.xml"
|
||||
|
||||
; Specifies the location and filename of the inventory library assets control file. The path can be relative or absolute
|
||||
; Setting is optional. Default is ./assets/AssetSets.xml
|
||||
;AssetSetsXMLFile="./assets/AssetSets.xml"
|
||||
|
||||
dump_assets_to_file = false
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue