From d259238c748aafe366fd1d04e0248ef23116fd28 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Tue, 3 Feb 2009 05:20:44 +0000 Subject: - moved data plugin loading code from various places to OpenSim/Data/DataPluginFactory.cs - removed dependencies on a few executable assemblies in bin/OpenSim.Data.addin.xml - trim trailing whitespace --- OpenSim/Data/DataPluginFactory.cs | 141 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 OpenSim/Data/DataPluginFactory.cs (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/DataPluginFactory.cs b/OpenSim/Data/DataPluginFactory.cs new file mode 100644 index 0000000..5293e94 --- /dev/null +++ b/OpenSim/Data/DataPluginFactory.cs @@ -0,0 +1,141 @@ +/* + * 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.Collections.Generic; +using OpenSim.Framework; + +namespace OpenSim.Data +{ + /// + /// A static class containing a series of methods for obtaining handles to + /// database storage objects. + /// + // Yeah, it's not really a factory, but maybe it'll morph into one? + public static class DataPluginFactory + { + /// + /// Returns a list of new inventory data plugins. Plugins will be + /// requested in the order they were added. + /// + /// + /// The filename of the inventory server plugin DLL. + /// + /// + /// The connection string for the storage backend. + /// + public static List LoadInventoryDataPlugins(string provider, string connect) + { + PluginLoader loader = new PluginLoader (new InventoryDataInitialiser(connect)); + + // loader will try to load all providers (MySQL, MSSQL, etc) + // unless it is constrainted to the correct "Provider" entry in the addin.xml + loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter(provider)); + loader.Load(); + + return loader.Plugins; + } + + /// + /// Returns a list of new user data plugins. Plugins will be requested + /// in the order they were added. + /// + /// + /// The filename of the user data plugin DLL. + /// + /// + /// The connection string for the storage backend. + /// + public static List LoadUserDataPlugins(string provider, string connect) + { + PluginLoader loader = new PluginLoader(new UserDataInitialiser(connect)); + + // loader will try to load all providers (MySQL, MSSQL, etc) + // unless it is constrainted to the correct "Provider" entry in the addin.xml + loader.Add("/OpenSim/UserData", new PluginProviderFilter(provider)); + loader.Load(); + + return loader.Plugins; + } + + /// + /// Returns a list of new grid data plugins. Plugins will be requested + /// in the order they were added. + /// + /// + /// The filename of the user data plugin DLL. + /// + /// + /// The connection string for the storage backend. + /// + public static List LoadGridDataPlugins(string provider, string connect) + { + PluginLoader loader = new PluginLoader(new GridDataInitialiser(connect)); + + // loader will try to load all providers (MySQL, MSSQL, etc) + // unless it is constrainted to the correct "Provider" entry in the addin.xml + loader.Add("/OpenSim/GridData", new PluginProviderFilter(provider)); + loader.Load(); + + return loader.Plugins; + } + + /// + /// Returns a list of new log data plugins. Plugins will be requested + /// in the order they were added. + /// + /// + /// The filename of the user data plugin DLL. + /// + /// + /// The connection string for the storage backend. + /// + public static List LoadLogDataPlugins(string provider, string connect) + { + PluginLoader loader = new PluginLoader(new LogDataInitialiser(connect)); + + // loader will try to load all providers (MySQL, MSSQL, etc) + // unless it is constrainted to the correct "Provider" entry in the addin.xml + loader.Add("/OpenSim/LogData", new PluginProviderFilter(provider)); + loader.Load(); + + return loader.Plugins; + } + + public static IAssetDataPlugin LoadAssetDataPlugin(string provider, string connect) + { + PluginLoader loader = new PluginLoader (new AssetDataInitialiser (connect)); + + // loader will try to load all providers (MySQL, MSSQL, etc) + // unless it is constrainted to the correct "Provider" entry in the addin.xml + loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider)); + loader.Load(); + + return loader.Plugin; + } + + } +} -- cgit v1.1