29 using System.Reflection;
32 using OpenSim.Framework;
34 using OpenSim.Server.Base;
35 using OpenSim.Services.Interfaces;
36 using OpenSim.Services.Base;
38 namespace OpenSim.Services.AssetService
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 protected bool HasChainedAssetService {
get {
return m_ChainedAssetService != null; } }
52 string dllName = String.Empty;
53 string connString = String.Empty;
58 IConfig assetConfig = config.Configs[configName];
59 if (assetConfig != null)
61 dllName = assetConfig.GetString(
"StorageProvider", dllName);
62 connString = assetConfig.GetString(
"ConnectionString", connString);
68 IConfig dbConfig = config.Configs[
"DatabaseService"];
71 if (dllName == String.Empty)
72 dllName = dbConfig.GetString(
"StorageProvider", String.Empty);
73 if (connString == String.Empty)
74 connString = dbConfig.GetString(
"ConnectionString", String.Empty);
80 if (dllName.Equals(String.Empty))
81 throw new Exception(
"No StorageProvider configured");
83 m_Database = LoadPlugin<IXAssetDataPlugin>(dllName);
84 if (m_Database == null)
85 throw new Exception(
"Could not find a storage interface in the given module");
87 string chainedAssetServiceDesignator = assetConfig.GetString(
"ChainedServiceModule", null);
89 if (chainedAssetServiceDesignator != null)
92 "[XASSET SERVICE BASE]: Loading chained asset service from {0}", chainedAssetServiceDesignator);
94 Object[] args =
new Object[] { config, configName };
95 m_ChainedAssetService = ServerUtils.LoadPlugin<
IAssetService>(chainedAssetServiceDesignator, args);
97 if (!HasChainedAssetService)
99 String.Format(
"Failed to load ChainedAssetService from {0}", chainedAssetServiceDesignator));
102 m_Database.Initialise(connString);
104 if (HasChainedAssetService)
106 string loaderName = assetConfig.GetString(
"DefaultAssetLoader",
109 if (loaderName != String.Empty)
111 m_AssetLoader = LoadPlugin<IAssetLoader>(loaderName);
113 if (m_AssetLoader == null)
114 throw new Exception(
"Asset loader could not be loaded");
IXAssetDataPlugin m_Database
XAssetServiceBase(IConfigSource config, string configName)
IAssetService m_ChainedAssetService
IAssetLoader m_AssetLoader
This interface exists to distinguish between the normal IAssetDataPlugin and the one used by XAssetSe...