29 using System.Reflection;
31 using OpenSim.Framework;
33 using OpenSim.Services.Interfaces;
34 using OpenSim.Services.Base;
36 namespace OpenSim.Services.AssetService
42 protected string m_ConfigName =
"AssetService";
45 : this(config,
"AssetService")
51 if (configName !=
string.Empty)
52 m_ConfigName = configName;
54 string dllName = String.Empty;
55 string connString = String.Empty;
60 IConfig assetConfig = config.Configs[m_ConfigName];
61 if (assetConfig != null)
63 dllName = assetConfig.GetString(
"StorageProvider", dllName);
64 connString = assetConfig.GetString(
"ConnectionString", connString);
70 IConfig dbConfig = config.Configs[
"DatabaseService"];
73 if (dllName == String.Empty)
74 dllName = dbConfig.GetString(
"StorageProvider", String.Empty);
75 if (connString == String.Empty)
76 connString = dbConfig.GetString(
"ConnectionString", String.Empty);
82 if (dllName.Equals(String.Empty))
83 throw new Exception(
"No StorageProvider configured");
85 m_Database = LoadPlugin<IAssetDataPlugin>(dllName);
86 if (m_Database == null)
87 throw new Exception(
string.Format(
"Could not find a storage interface in the module {0}", dllName));
89 m_Database.Initialise(connString);
91 string loaderName = assetConfig.GetString(
"DefaultAssetLoader",
94 if (loaderName != String.Empty)
96 m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName);
98 if (m_AssetLoader == null)
99 throw new Exception(
string.Format(
"Asset loader could not be loaded from {0}", loaderName));
AssetServiceBase(IConfigSource config)
AssetServiceBase(IConfigSource config, string configName)