diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/SQLAssetServer.cs | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs b/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs deleted file mode 100644 index 227744d..0000000 --- a/OpenSim/Framework/Communications/Cache/SQLAssetServer.cs +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | using OpenSim.Data; | ||
32 | |||
33 | namespace OpenSim.Framework.Communications.Cache | ||
34 | { | ||
35 | public class SQLAssetServer : AssetServerBase | ||
36 | { | ||
37 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
38 | |||
39 | #region IPlugin | ||
40 | |||
41 | public override string Name | ||
42 | { | ||
43 | get { return "SQL"; } | ||
44 | } | ||
45 | |||
46 | public override string Version | ||
47 | { | ||
48 | get { return "1.0"; } | ||
49 | } | ||
50 | |||
51 | public override void Initialise(ConfigSettings p_set) | ||
52 | { | ||
53 | m_log.Debug("[SQLAssetServer]: Plugin configured initialisation"); | ||
54 | Initialise(p_set.StandaloneAssetPlugin,p_set.StandaloneAssetSource); | ||
55 | } | ||
56 | |||
57 | #endregion | ||
58 | |||
59 | public SQLAssetServer() {} | ||
60 | |||
61 | public SQLAssetServer(string pluginName, string connect) | ||
62 | { | ||
63 | m_log.Debug("[SQLAssetServer]: Direct constructor"); | ||
64 | Initialise(pluginName, connect); | ||
65 | } | ||
66 | |||
67 | public void Initialise(string pluginName, string connect) | ||
68 | { | ||
69 | AddPlugin(pluginName, connect); | ||
70 | } | ||
71 | |||
72 | public SQLAssetServer(IAssetDataPlugin assetProvider) | ||
73 | { | ||
74 | m_assetProvider = assetProvider; | ||
75 | } | ||
76 | |||
77 | public void AddPlugin(string FileName, string connect) | ||
78 | { | ||
79 | m_log.Info("[SQLAssetServer]: AssetStorage: Attempting to load " + FileName); | ||
80 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); | ||
81 | |||
82 | foreach (Type pluginType in pluginAssembly.GetTypes()) | ||
83 | { | ||
84 | if (!pluginType.IsAbstract) | ||
85 | { | ||
86 | Type typeInterface = pluginType.GetInterface("IAssetDataPlugin", true); | ||
87 | |||
88 | if (typeInterface != null) | ||
89 | { | ||
90 | IAssetDataPlugin plug = | ||
91 | (IAssetDataPlugin) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); | ||
92 | m_assetProvider = plug; | ||
93 | m_assetProvider.Initialise(connect); | ||
94 | |||
95 | m_log.Info("[AssetStorage]: " + | ||
96 | "Added " + m_assetProvider.Name + " " + | ||
97 | m_assetProvider.Version); | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | } | ||
102 | |||
103 | protected override AssetBase GetAsset(AssetRequest req) | ||
104 | { | ||
105 | return m_assetProvider.FetchAsset(req.AssetID); | ||
106 | } | ||
107 | |||
108 | public override void StoreAsset(AssetBase asset) | ||
109 | { | ||
110 | m_assetProvider.CreateAsset(asset); | ||
111 | } | ||
112 | } | ||
113 | } | ||