aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
diff options
context:
space:
mode:
authorSean Dague2009-02-16 12:20:31 +0000
committerSean Dague2009-02-16 12:20:31 +0000
commitf4bec00057fb6987f4ea166347156e1abb985ec1 (patch)
treea8b4e9461b077f1e2e36876d0aea263eb2ceb177 /OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
parentcosmetic: adding region name to logging statement (diff)
downloadopensim-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/Communications/Cache/CryptoGridAssetClient.cs')
-rw-r--r--OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs48
1 files changed, 40 insertions, 8 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
index 55db289..0f4e8ac 100644
--- a/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
+++ b/OpenSim/Framework/Communications/Cache/CryptoGridAssetClient.cs
@@ -44,9 +44,37 @@ namespace OpenSim.Framework.Communications.Cache
44{ 44{
45 public class CryptoGridAssetClient : AssetServerBase 45 public class CryptoGridAssetClient : AssetServerBase
46 { 46 {
47
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49
50 private string _assetServerUrl;
51 private bool m_encryptOnUpload;
52 private RjinKeyfile m_encryptKey;
53 private readonly Dictionary<string,RjinKeyfile> m_keyfiles = new Dictionary<string, RjinKeyfile>();
54
55 #region IPlugin
56
57 public override string Name
58 {
59 get { return "Crypto"; }
60 }
61
62 public override string Version
63 {
64 get { return "1.0"; }
65 }
66
67 public override void Initialise(ConfigSettings p_set, string p_url, string p_dir, bool p_t)
68 {
69 m_log.Debug("[CRYPTOGRID] Plugin configured initialisation");
70 Initialise(p_url, p_dir, p_t);
71 }
72
73 #endregion
74
47 #region Keyfile Classes 75 #region Keyfile Classes
48 [Serializable] 76 [Serializable]
49 private class RjinKeyfile 77 public class RjinKeyfile
50 { 78 {
51 public string Secret; 79 public string Secret;
52 public string AlsoKnownAs; 80 public string AlsoKnownAs;
@@ -94,7 +122,7 @@ namespace OpenSim.Framework.Communications.Cache
94 /// this may not be the most efficient way of handling encryption, so - as 122 /// this may not be the most efficient way of handling encryption, so - as
95 /// soon as you feel comfortable with it - you may want to redesign this class. 123 /// soon as you feel comfortable with it - you may want to redesign this class.
96 /// </summary> 124 /// </summary>
97 private class UtilRijndael 125 public class UtilRijndael
98 { 126 {
99 /// <summary> 127 /// <summary>
100 /// Encrypts specified plaintext using Rijndael symmetric key algorithm 128 /// Encrypts specified plaintext using Rijndael symmetric key algorithm
@@ -332,15 +360,19 @@ namespace OpenSim.Framework.Communications.Cache
332 } 360 }
333 #endregion 361 #endregion
334 362
335 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 363 public CryptoGridAssetClient() {}
336
337 private readonly string _assetServerUrl;
338 private readonly bool m_encryptOnUpload;
339 private readonly RjinKeyfile m_encryptKey;
340 private readonly Dictionary<string,RjinKeyfile> m_keyfiles = new Dictionary<string, RjinKeyfile>();
341 364
342 public CryptoGridAssetClient(string serverUrl, string keydir, bool decOnly) 365 public CryptoGridAssetClient(string serverUrl, string keydir, bool decOnly)
343 { 366 {
367 m_log.Debug("[CRYPTOGRID] Direct constructor");
368 Initialise(serverUrl, keydir, decOnly);
369 }
370
371 public void Initialise(string serverUrl, string keydir, bool decOnly)
372 {
373
374 m_log.Debug("[CRYPTOGRID] Common constructor");
375
344 _assetServerUrl = serverUrl; 376 _assetServerUrl = serverUrl;
345 377
346 string[] keys = Directory.GetFiles(keydir, "*.deckey"); 378 string[] keys = Directory.GetFiles(keydir, "*.deckey");