From e12b0a249674bbe4b1980c74f13d8f09cc2e4432 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Tue, 3 Feb 2009 05:20:16 +0000 Subject: - move IAssetDataPlugin from OpenSim/Framework/IAssetProvider.cs to OpenSim/Data/IAssetData.cs - remove some trailing whitespace --- OpenSim/Data/IAssetData.cs | 52 ++++++++++++++++++++++ OpenSim/Data/MSSQL/MSSQLAssetData.cs | 4 +- .../Communications/Cache/AssetServerBase.cs | 1 + .../Communications/Cache/SQLAssetServer.cs | 1 + OpenSim/Framework/IAssetProvider.cs | 51 --------------------- OpenSim/Grid/AssetServer/Main.cs | 1 + OpenSim/Grid/AssetServer/RestService.cs | 3 +- .../Modules/Hypergrid/HGStandaloneAssetService.cs | 45 ++++++++++--------- OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs | 6 +-- 9 files changed, 85 insertions(+), 79 deletions(-) create mode 100644 OpenSim/Data/IAssetData.cs delete mode 100644 OpenSim/Framework/IAssetProvider.cs (limited to 'OpenSim') diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs new file mode 100644 index 0000000..47e25f3 --- /dev/null +++ b/OpenSim/Data/IAssetData.cs @@ -0,0 +1,52 @@ +/* + * 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 OpenMetaverse; +using OpenSim.Framework; + +namespace OpenSim.Data +{ + public interface IAssetDataPlugin : IPlugin + { + AssetBase FetchAsset(UUID uuid); + void CreateAsset(AssetBase asset); + void UpdateAsset(AssetBase asset); + bool ExistsAsset(UUID uuid); + void Initialise(string connect); + } + + public class AssetDataInitialiser : PluginInitialiserBase + { + private string connect; + public AssetDataInitialiser (string s) { connect = s; } + public override void Initialise (IPlugin plugin) + { + IAssetDataPlugin p = plugin as IAssetDataPlugin; + p.Initialise (connect); + } + } +} diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 2fe89e2..3eaae12 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs @@ -42,7 +42,7 @@ namespace OpenSim.Data.MSSQL private const string _migrationStore = "AssetStore"; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private long TicksToEpoch; + private long TicksToEpoch; /// /// Database manager /// @@ -212,7 +212,7 @@ namespace OpenSim.Data.MSSQL } } -// Commented out since currently unused - this probably should be called in FetchAsset() +// Commented out since currently unused - this probably should be called in FetchAsset() // private void UpdateAccessTime(AssetBase asset) // { // using (AutoClosingSqlCommand cmd = database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id")) diff --git a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs index 7fb06b9..cc5ba8e 100644 --- a/OpenSim/Framework/Communications/Cache/AssetServerBase.cs +++ b/OpenSim/Framework/Communications/Cache/AssetServerBase.cs @@ -32,6 +32,7 @@ using OpenMetaverse; using log4net; using OpenSim.Framework.AssetLoader.Filesystem; using OpenSim.Framework.Statistics; +using OpenSim.Data; namespace OpenSim.Framework.Communications.Cache { diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs index 00dbad0..6266bf0 100644 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs @@ -28,6 +28,7 @@ using System; using System.Reflection; using log4net; +using OpenSim.Data; namespace OpenSim.Framework.Communications.Cache { diff --git a/OpenSim/Framework/IAssetProvider.cs b/OpenSim/Framework/IAssetProvider.cs deleted file mode 100644 index 77e0d0c..0000000 --- a/OpenSim/Framework/IAssetProvider.cs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 OpenMetaverse; - -namespace OpenSim.Framework -{ - public interface IAssetDataPlugin : IPlugin - { - AssetBase FetchAsset(UUID uuid); - void CreateAsset(AssetBase asset); - void UpdateAsset(AssetBase asset); - bool ExistsAsset(UUID uuid); - void Initialise(string connect); - } - - public class AssetDataInitialiser : PluginInitialiserBase - { - private string connect; - public AssetDataInitialiser (string s) { connect = s; } - public override void Initialise (IPlugin plugin) - { - IAssetDataPlugin p = plugin as IAssetDataPlugin; - p.Initialise (connect); - } - } -} diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index b5c8df0..07fe0a4 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs @@ -36,6 +36,7 @@ using OpenSim.Framework.AssetLoader.Filesystem; using OpenSim.Framework.Console; using OpenSim.Framework.Servers; using OpenSim.Framework.Statistics; +using OpenSim.Data; namespace OpenSim.Grid.AssetServer { diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index e81cb3f..3613cd8 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs @@ -37,6 +37,7 @@ using log4net; using OpenSim.Framework; using OpenSim.Framework.Servers; using OpenSim.Framework.Statistics; +using OpenSim.Data; namespace OpenSim.Grid.AssetServer { @@ -98,7 +99,7 @@ namespace OpenSim.Grid.AssetServer result = ms.GetBuffer(); //Ckrinke 1/11/09 Commenting out the succesful REST message as under heavy use there -//are multiple messages in a second and that is usually (in my experience) meaning +//are multiple messages in a second and that is usually (in my experience) meaning //the logging itself is slowing down the program. Leaving the unsuccesful message //as we need to know about that path. // m_log.InfoFormat( diff --git a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs index 24de4e8..285a019 100644 --- a/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs +++ b/OpenSim/Region/Environment/Modules/Hypergrid/HGStandaloneAssetService.cs @@ -1,29 +1,29 @@ /** * Copyright (c) 2008, Contributors. All rights reserved. * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without modification, + * + * 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, + * + * * 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 + * * 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 Organizations nor the names of Individual - * Contributors may be used to endorse or promote products derived from + * Contributors may be used to endorse or promote products derived from * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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 + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR 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; @@ -43,6 +43,7 @@ using OpenSim.Framework.Servers; using OpenSim.Region.Environment.Interfaces; using OpenSim.Region.Environment.Scenes; using OpenSim.Grid.AssetServer; +using OpenSim.Data; namespace OpenSim.Region.Environment.Modules.Hypergrid { @@ -51,10 +52,10 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static bool initialized = false; private static bool enabled = false; - + Scene m_scene; //AssetService m_assetService; - + #region IRegionModule interface public void Initialise(Scene scene, IConfigSource config) @@ -98,7 +99,7 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid } - public class AssetService + public class AssetService { private IUserService m_userService; private bool m_doLookup = false; @@ -120,8 +121,8 @@ namespace OpenSim.Region.Environment.Modules.Hypergrid protected void AddHttpHandlers(Scene m_scene) { IAssetDataPlugin m_assetProvider = ((AssetServerBase)m_scene.AssetCache.AssetServer).AssetProviderPlugin; - - BaseHttpServer httpServer = m_scene.CommsManager.HttpServer; + + BaseHttpServer httpServer = m_scene.CommsManager.HttpServer; httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider)); httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider)); diff --git a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs index ebece27..fc84eac 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs @@ -27,7 +27,7 @@ using OpenMetaverse; using OpenSim.Framework; -using OpenSim.Framework.Communications; +using OpenSim.Data; namespace OpenSim.Tests.Common.Mock { @@ -35,7 +35,7 @@ namespace OpenSim.Tests.Common.Mock /// In memory asset data plugin for test purposes. Could be another dll when properly filled out and when the /// mono addin plugin system starts co-operating with the unit test system. Currently no locking since unit /// tests are single threaded. - /// + /// public class TestAssetDataPlugin : IAssetDataPlugin { public string Version { get { return "0"; } } @@ -43,7 +43,7 @@ namespace OpenSim.Tests.Common.Mock public void Initialise() {} public void Dispose() {} - + public AssetBase FetchAsset(UUID uuid) { return null; } public void CreateAsset(AssetBase asset) {} public void UpdateAsset(AssetBase asset) {} -- cgit v1.1