From 1232eb1c587ffdc06c26a1c5b1b4fa5f22848754 Mon Sep 17 00:00:00 2001 From: Tleiades Hax Date: Sat, 13 Oct 2007 07:26:21 +0000 Subject: Asset server implementation. Again one of these "plumbing" releases, where no real functionality has been introduced, but ground work has been made, enabling the asset server, and preparing the sim server to query the asset server. Introduced an "IPlugin" interface, which plugins can inherit from. --- .../Framework/General/Configuration/AssetConfig.cs | 54 ++++++++++++++++++++++ .../Framework/General/Interfaces/IAssetProvider.cs | 3 +- OpenSim/Framework/General/Interfaces/IPlugin.cs | 29 ++++++++++++ 3 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 OpenSim/Framework/General/Configuration/AssetConfig.cs create mode 100644 OpenSim/Framework/General/Interfaces/IPlugin.cs (limited to 'OpenSim/Framework/General') diff --git a/OpenSim/Framework/General/Configuration/AssetConfig.cs b/OpenSim/Framework/General/Configuration/AssetConfig.cs new file mode 100644 index 0000000..e5f1c88 --- /dev/null +++ b/OpenSim/Framework/General/Configuration/AssetConfig.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Configuration +{ + /// + /// UserConfig -- For User Server Configuration + /// + public class AssetConfig + { + public string DefaultStartupMsg = ""; + + public string DatabaseProvider = ""; + + public uint HttpPort = 8003; + + private ConfigurationMember configMember; + + public AssetConfig(string description, string filename) + { + configMember = new ConfigurationMember(filename, description, this.loadConfigurationOptions, this.handleIncomingConfiguration); + configMember.performConfigurationRetrieve(); + } + + public void loadConfigurationOptions() + { + configMember.addConfigurationOption("default_startup_message", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, "Default Startup Message", "Welcome to OGS", false); + + configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING, "DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false); + + configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, "Http Listener port", "8003", false); + + } + + public bool handleIncomingConfiguration(string configuration_key, object configuration_result) + { + switch (configuration_key) + { + case "default_startup_message": + this.DefaultStartupMsg = (string)configuration_result; + break; + case "database_provider": + this.DatabaseProvider = (string)configuration_result; + break; + case "http_port": + HttpPort = (uint)configuration_result; + break; + } + + return true; + } + } +} diff --git a/OpenSim/Framework/General/Interfaces/IAssetProvider.cs b/OpenSim/Framework/General/Interfaces/IAssetProvider.cs index daf9d6d..0b39d1f 100644 --- a/OpenSim/Framework/General/Interfaces/IAssetProvider.cs +++ b/OpenSim/Framework/General/Interfaces/IAssetProvider.cs @@ -6,9 +6,8 @@ using libsecondlife; namespace OpenSim.Framework.Interfaces { - public interface IAssetProvider + public interface IAssetProvider : IPlugin { - void Initialise(string dbfile, string dbname); AssetBase FetchAsset(LLUUID uuid); void CreateAsset(AssetBase asset); void UpdateAsset(AssetBase asset); diff --git a/OpenSim/Framework/General/Interfaces/IPlugin.cs b/OpenSim/Framework/General/Interfaces/IPlugin.cs new file mode 100644 index 0000000..ceb8b63 --- /dev/null +++ b/OpenSim/Framework/General/Interfaces/IPlugin.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Framework.Interfaces +{ + /// + /// This interface, describes a generic plugin + /// + public interface IPlugin + { + /// + /// Returns the plugin version + /// + /// Plugin version in MAJOR.MINOR.REVISION.BUILD format + string Version { get; } + + /// + /// Returns the plugin name + /// + /// Plugin name, eg MySQL User Provider + string Name { get; } + + /// + /// Initialises the plugin (artificial constructor) + /// + void Initialise(); + } +} -- cgit v1.1