From aec069d161e6d818c4b1d9b7448aebade62c29c5 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 8 May 2009 14:08:41 +0000 Subject: More additions to the nextgen reference UGAIM --- OpenSim/Services/AssetService/AssetServiceBase.cs | 76 +++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 OpenSim/Services/AssetService/AssetServiceBase.cs (limited to 'OpenSim/Services/AssetService/AssetServiceBase.cs') diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs new file mode 100644 index 0000000..4c5ba0f --- /dev/null +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -0,0 +1,76 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Reflection; +using Nini.Config; +using OpenSim.Framework; +using OpenSim.Data; +using OpenSim.Services.Interfaces; +using OpenSim.Services.Base; + +namespace OpenSim.Services.AssetService +{ + public class AssetServiceBase : ServiceBase + { + protected IAssetDataPlugin m_Database = null; + protected IAssetLoader m_AssetLoader = null; + + public AssetServiceBase(IConfigSource config) : base(config) + { + IConfig assetConfig = config.Configs["AssetService"]; + if (assetConfig == null) + throw new Exception("No AssetService configuration"); + + string dllName = assetConfig.GetString("StorageProvider", + String.Empty); + + if (dllName == String.Empty) + throw new Exception("No StorageProvider configured"); + + string connString = assetConfig.GetString("ConnectionString", + String.Empty); + + m_Database = LoadPlugin(dllName); + if (m_Database == null) + throw new Exception("Could not find a storage interface in the given module"); + + m_Database.Initialise(connString); + + string loaderName = assetConfig.GetString("DefaultAssetLoader", + String.Empty); + + if (loaderName != String.Empty) + { + m_AssetLoader = LoadPlugin(loaderName); + + if (m_AssetLoader == null) + throw new Exception("Asset loader could not be loaded"); + } + } + } +} -- cgit v1.1 From 840de6c036570d559ec6924cd8405d3f34a99fdd Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 1 Jun 2009 06:37:14 +0000 Subject: Minor: Change OpenSim to OpenSimulator in older copyright headers and LICENSE.txt. --- OpenSim/Services/AssetService/AssetServiceBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Services/AssetService/AssetServiceBase.cs') diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index 4c5ba0f..d5faffb 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -9,7 +9,7 @@ * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSim Project nor the + * * Neither the name of the OpenSimulator Project nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * -- cgit v1.1 From 0f367bd7bbc5d22d4834e1eb0f1671381485143e Mon Sep 17 00:00:00 2001 From: diva Date: Wed, 10 Jun 2009 13:18:32 +0000 Subject: Heart surgery no.2: the inventory service hooks. Several improvements in the connectors themselves. Several improvements in configurations. Needed to add a hack in IUserService and UserManagerBase, to be removed when that service is refactored. --- OpenSim/Services/AssetService/AssetServiceBase.cs | 34 +++++++++++++++++------ 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'OpenSim/Services/AssetService/AssetServiceBase.cs') diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index d5faffb..c42d469 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -42,18 +42,34 @@ namespace OpenSim.Services.AssetService public AssetServiceBase(IConfigSource config) : base(config) { - IConfig assetConfig = config.Configs["AssetService"]; - if (assetConfig == null) - throw new Exception("No AssetService configuration"); + string dllName = String.Empty; + string connString = String.Empty; - string dllName = assetConfig.GetString("StorageProvider", - String.Empty); + // + // Try reading the [DatabaseService] section first, if it exists + // + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) + { + dllName = dbConfig.GetString("StorageProvider", String.Empty); + connString = dbConfig.GetString("ConnectionString", String.Empty); + } - if (dllName == String.Empty) - throw new Exception("No StorageProvider configured"); + // + // Try reading the more specific [AssetService] section, if it exists + // + IConfig assetConfig = config.Configs["AssetService"]; + if (assetConfig != null) + { + dllName = assetConfig.GetString("StorageProvider", dllName); + connString = assetConfig.GetString("ConnectionString", connString); + } - string connString = assetConfig.GetString("ConnectionString", - String.Empty); + // + // We tried, but this doesn't exist. We can't proceed. + // + if (dllName.Equals(String.Empty)) + throw new Exception("No StorageProvider configured"); m_Database = LoadPlugin(dllName); if (m_Database == null) -- cgit v1.1 From 044446821b7d1d4550e43b0351c2611026874755 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 22 Jun 2009 12:18:04 +0000 Subject: Committing the meat of the user server interface and the bones of the service implementation --- OpenSim/Services/AssetService/AssetServiceBase.cs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'OpenSim/Services/AssetService/AssetServiceBase.cs') diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index c42d469..c60dd1f 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -46,23 +46,25 @@ namespace OpenSim.Services.AssetService string connString = String.Empty; // - // Try reading the [DatabaseService] section first, if it exists + // Try reading the [AssetService] section first, if it exists // - IConfig dbConfig = config.Configs["DatabaseService"]; - if (dbConfig != null) + IConfig assetConfig = config.Configs["AssetService"]; + if (assetConfig != null) { - dllName = dbConfig.GetString("StorageProvider", String.Empty); - connString = dbConfig.GetString("ConnectionString", String.Empty); + dllName = assetConfig.GetString("StorageProvider", dllName); + connString = assetConfig.GetString("ConnectionString", connString); } // - // Try reading the more specific [AssetService] section, if it exists + // Try reading the [DatabaseService] section, if it exists // - IConfig assetConfig = config.Configs["AssetService"]; - if (assetConfig != null) + IConfig dbConfig = config.Configs["DatabaseService"]; + if (dbConfig != null) { - dllName = assetConfig.GetString("StorageProvider", dllName); - connString = assetConfig.GetString("ConnectionString", connString); + if (dllName != String.Empty) + dllName = dbConfig.GetString("StorageProvider", String.Empty); + if (connString != String.Empty) + connString = dbConfig.GetString("ConnectionString", String.Empty); } // -- cgit v1.1 From 7f4a3392fced9cac79a39b23f564a6d2720812c9 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Tue, 23 Jun 2009 08:37:12 +0000 Subject: Fix the AssetServiceBase bug I introduced by reordering configuration load order. Thanks, Grumly57, for pointing it out. The point of the original change was to let the more specific setting override the less specific one, actually, I disabled the use of the less specific one. --- OpenSim/Services/AssetService/AssetServiceBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/AssetService/AssetServiceBase.cs') diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index c60dd1f..86752f9 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -61,9 +61,9 @@ namespace OpenSim.Services.AssetService IConfig dbConfig = config.Configs["DatabaseService"]; if (dbConfig != null) { - if (dllName != String.Empty) + if (dllName == String.Empty) dllName = dbConfig.GetString("StorageProvider", String.Empty); - if (connString != String.Empty) + if (connString == String.Empty) connString = dbConfig.GetString("ConnectionString", String.Empty); } -- cgit v1.1 From 8131a24cde3f3877b3b8dd850871c57c17b2b216 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 27 Mar 2012 10:08:13 -0700 Subject: Send the config section name up to the service classes themselves (XInventory and Assets). --- OpenSim/Services/AssetService/AssetServiceBase.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/AssetService/AssetServiceBase.cs') diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index 86752f9..177c565 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -39,16 +39,25 @@ namespace OpenSim.Services.AssetService { protected IAssetDataPlugin m_Database = null; protected IAssetLoader m_AssetLoader = null; + protected string m_ConfigName = "AssetService"; - public AssetServiceBase(IConfigSource config) : base(config) + public AssetServiceBase(IConfigSource config) + : this(config, "AssetService") { + } + + public AssetServiceBase(IConfigSource config, string configName) : base(config) + { + if (configName != string.Empty) + m_ConfigName = configName; + string dllName = String.Empty; string connString = String.Empty; // - // Try reading the [AssetService] section first, if it exists + // Try reading the [AssetService] section, if it exists // - IConfig assetConfig = config.Configs["AssetService"]; + IConfig assetConfig = config.Configs[m_ConfigName]; if (assetConfig != null) { dllName = assetConfig.GetString("StorageProvider", dllName); -- cgit v1.1 From 1ec84ac8b160c1a6ee903b832c75635d1219fe5a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 15 Sep 2012 02:12:26 +0100 Subject: Add basic asset connector tests to check behaviour for normal, local and temporary assets. Make AssetServiceConnector return more useful data on failure, such as what DLL it was trying to load Allow LocalAssetServiceConnector.GetData() to work without a cache present, as works for the other lasc Get* methods. --- OpenSim/Services/AssetService/AssetServiceBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Services/AssetService/AssetServiceBase.cs') diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index 177c565..58ab052 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -84,7 +84,7 @@ namespace OpenSim.Services.AssetService m_Database = LoadPlugin(dllName); if (m_Database == null) - throw new Exception("Could not find a storage interface in the given module"); + throw new Exception(string.Format("Could not find a storage interface in the module {0}", dllName)); m_Database.Initialise(connString); @@ -96,7 +96,7 @@ namespace OpenSim.Services.AssetService m_AssetLoader = LoadPlugin(loaderName); if (m_AssetLoader == null) - throw new Exception("Asset loader could not be loaded"); + throw new Exception(string.Format("Asset loader could not be loaded from {0}", loaderName)); } } } -- cgit v1.1