diff options
author | Sean Dague | 2009-02-16 12:20:31 +0000 |
---|---|---|
committer | Sean Dague | 2009-02-16 12:20:31 +0000 |
commit | f4bec00057fb6987f4ea166347156e1abb985ec1 (patch) | |
tree | a8b4e9461b077f1e2e36876d0aea263eb2ceb177 /OpenSim/Framework/IAssetServer.cs | |
parent | cosmetic: adding region name to logging statement (diff) | |
download | opensim-SC-f4bec00057fb6987f4ea166347156e1abb985ec1.zip opensim-SC-f4bec00057fb6987f4ea166347156e1abb985ec1.tar.gz opensim-SC-f4bec00057fb6987f4ea166347156e1abb985ec1.tar.bz2 opensim-SC-f4bec00057fb6987f4ea166347156e1abb985ec1.tar.xz |
From: Alan Webb <awebb@linux.vnet.ibm.com>
The change makes two principal implementation changes:
[1] It removes the hard coded set of possible asset server client
implementations, allowing any arbitrary implementation that has been
identified to the PluginLoader as an appropriate extension. The
extension point for asset server client extension
is /OpenSim/AssetServerClient. All of the old configuration rules have
been preserved, and any of the legacy configuration values will still
work as they did before, except the implementation is now loaded as a
plug-in, rather than as a hard-coded instantiation of a specific class.
The re-hashing of IAssetServer as an extension of IPlugin made upgrading
of the implementation classes a necessity.
Caveat: I have not been able to meaningfully test the crypto-grid
clients. I believe they should work correctly, but the refactoring
necessary to handle plug-in based initialization (vs constructor-based
initialisation) admits the possibility of a problem.
[2] The asset cache implementation, previously introduce as a hard-code
class instantiation is now implemented as an IPlugin. Once again the
previous (configurationless) behavior has been preserved. But now it is
possible for those interested in experimenting with cache technologies
to do so simply by introducing a new extension for the asset cache
extension point (/OpenSim/AssetCache).
I've tested all of the configuration settings, after applying the patch
to a newly extracted tree, and they seem to work OK.
Diffstat (limited to 'OpenSim/Framework/IAssetServer.cs')
-rw-r--r-- | OpenSim/Framework/IAssetServer.cs | 59 |
1 files changed, 58 insertions, 1 deletions
diff --git a/OpenSim/Framework/IAssetServer.cs b/OpenSim/Framework/IAssetServer.cs index d2f5ce7..0d9afe9 100644 --- a/OpenSim/Framework/IAssetServer.cs +++ b/OpenSim/Framework/IAssetServer.cs | |||
@@ -32,8 +32,11 @@ namespace OpenSim.Framework | |||
32 | /// <summary> | 32 | /// <summary> |
33 | /// Description of IAssetServer. | 33 | /// Description of IAssetServer. |
34 | /// </summary> | 34 | /// </summary> |
35 | public interface IAssetServer | 35 | public interface IAssetServer : IPlugin |
36 | { | 36 | { |
37 | void Initialise(ConfigSettings settings); | ||
38 | void Initialise(ConfigSettings settings, string url, string dir, bool test); | ||
39 | void Initialise(ConfigSettings settings, string url); | ||
37 | void SetReceiver(IAssetReceiver receiver); | 40 | void SetReceiver(IAssetReceiver receiver); |
38 | void RequestAsset(UUID assetID, bool isTexture); | 41 | void RequestAsset(UUID assetID, bool isTexture); |
39 | void StoreAsset(AssetBase asset); | 42 | void StoreAsset(AssetBase asset); |
@@ -62,8 +65,62 @@ namespace OpenSim.Framework | |||
62 | void AssetNotFound(UUID assetID, bool IsTexture); | 65 | void AssetNotFound(UUID assetID, bool IsTexture); |
63 | } | 66 | } |
64 | 67 | ||
68 | public class AssetServerClientPluginInitialiser : PluginInitialiserBase | ||
69 | { | ||
70 | private ConfigSettings config; | ||
71 | |||
72 | public AssetServerClientPluginInitialiser (ConfigSettings p_sv) | ||
73 | { | ||
74 | config = p_sv; | ||
75 | } | ||
76 | public override void Initialise (IPlugin plugin) | ||
77 | { | ||
78 | IAssetServer p = plugin as IAssetServer; | ||
79 | p.Initialise (config); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | public class LegacyAssetServerClientPluginInitialiser : PluginInitialiserBase | ||
84 | { | ||
85 | private ConfigSettings config; | ||
86 | private string assetURL; | ||
87 | |||
88 | public LegacyAssetServerClientPluginInitialiser (ConfigSettings p_sv, string p_url) | ||
89 | { | ||
90 | config = p_sv; | ||
91 | assetURL = p_url; | ||
92 | } | ||
93 | public override void Initialise (IPlugin plugin) | ||
94 | { | ||
95 | IAssetServer p = plugin as IAssetServer; | ||
96 | p.Initialise (config, assetURL); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | public class CryptoAssetServerClientPluginInitialiser : PluginInitialiserBase | ||
101 | { | ||
102 | private ConfigSettings config; | ||
103 | private string assetURL; | ||
104 | private string currdir; | ||
105 | private bool test; | ||
106 | |||
107 | public CryptoAssetServerClientPluginInitialiser (ConfigSettings p_sv, string p_url, string p_dir, bool p_test) | ||
108 | { | ||
109 | config = p_sv; | ||
110 | assetURL = p_url; | ||
111 | currdir = p_dir; | ||
112 | test = p_test; | ||
113 | } | ||
114 | public override void Initialise (IPlugin plugin) | ||
115 | { | ||
116 | IAssetServer p = plugin as IAssetServer; | ||
117 | p.Initialise (config, assetURL, currdir, test); | ||
118 | } | ||
119 | } | ||
120 | |||
65 | public interface IAssetPlugin | 121 | public interface IAssetPlugin |
66 | { | 122 | { |
67 | IAssetServer GetAssetServer(); | 123 | IAssetServer GetAssetServer(); |
68 | } | 124 | } |
125 | |||
69 | } | 126 | } |