Ignore:
Timestamp:
11/07/11 06:07:52 (3 years ago)
Author:
lowjoel
Message:

Move all registrars to the Eraser.Plugins assembly. This is to prevent cyclic dependencies.

Location:
branches/eraser6/pluginsRewrite
Files:
3 added
10 edited
4 moved

Legend:

Unmodified
Added
Removed
  • branches/eraser6/pluginsRewrite/Eraser.Manager/EntropyPoller.cs

    r2352 r2357  
    3636{ 
    3737    /// <summary> 
    38     /// A class which manages all of the instances of the EntropySources 
    39     /// available. Plugins could register their entropy sources via this class. 
    40     /// </summary> 
    41     public class EntropySourceRegistrar : Registrar<EntropySource> 
    42     { 
    43         /// <summary> 
    44         /// Constructor. 
    45         /// </summary> 
    46         internal EntropySourceRegistrar() 
    47         { 
    48             Poller = new EntropyPoller(); 
    49         } 
    50  
    51         /// <summary> 
    52         /// Gets the entropy poller instance associated with this manager. 
    53         /// </summary> 
    54         public EntropyPoller Poller { get; private set; } 
    55          
    56         /// <summary> 
    57         /// The list of currently registered Entropy Sources. 
    58         /// </summary> 
    59         private Dictionary<Guid, EntropySource> sources = new Dictionary<Guid, EntropySource>(); 
    60     }; 
    61  
    62     /// <summary> 
    6338    /// A class which uses EntropyPoll class to fetch system data as a source of 
    6439    /// randomness at "regular" but "random" intervals 
  • branches/eraser6/pluginsRewrite/Eraser.Manager/Eraser.Manager.csproj

    r2347 r2357  
    6969    </Compile> 
    7070    <Compile Include="DirectExecutor.cs" /> 
    71     <Compile Include="EntropySource.cs" /> 
     71    <Compile Include="EntropyPoller.cs" /> 
    7272    <Compile Include="ErasureTarget.cs" /> 
    7373    <Compile Include="Exception.cs" /> 
    7474    <Compile Include="Executor.cs" /> 
    75     <Compile Include="FileSystem.cs" /> 
    7675    <Compile Include="ManagerLibrary.cs" /> 
    77     <Compile Include="ErasureMethod.cs" /> 
    78     <Compile Include="PRNG.cs" /> 
    7976    <Compile Include="Properties\AssemblyInfo.cs" /> 
    8077    <Compile Include="RemoteExecutor.cs" /> 
  • branches/eraser6/pluginsRewrite/Eraser.Manager/ErasureTarget.cs

    r2352 r2357  
    3535namespace Eraser.Manager 
    3636{ 
    37     public class ErasureTargetRegistrar : FactoryRegistrar<ErasureTarget> 
    38     { 
    39     } 
    40  
    4137    /// <summary> 
    4238    /// Maintains a collection of erasure targets. 
  • branches/eraser6/pluginsRewrite/Eraser.Manager/ManagerLibrary.cs

    r2291 r2357  
    4444            Instance = this; 
    4545            SettingsManager = settings; 
    46  
    47             EntropySourceRegistrar = new EntropySourceRegistrar(); 
    48             PrngRegistrar = new PrngRegistrar(); 
    49             ErasureMethodRegistrar = new ErasureMethodRegistrar(); 
    50             ErasureTargetRegistrar = new ErasureTargetRegistrar(); 
    51             FileSystemRegistrar = new FileSystemRegistrar(); 
    52             Host.Initialise(); 
     46            Host.Initialise( 
     47                entropySources:         new EntropySourceRegistrar(), 
     48                prngs:                  new PrngRegistrar(), 
     49                erasureMethods:         new ErasureMethodRegistrar(), 
     50                erasureTargetFactories: new FactoryRegistrar<Plugins.ExtensionPoints.ErasureTarget>(), 
     51                fileSystems:            new FileSystemRegistrar() 
     52            ); 
    5353            Host.Instance.Load(); 
    5454        } 
     
    6666            if (disposing) 
    6767            { 
    68                 EntropySourceRegistrar.Poller.Abort(); 
     68                ((EntropySourceRegistrar)Host.Instance.EntropySources).Poller.Abort(); 
    6969                Host.Instance.Dispose(); 
    7070                SettingsManager.Save(); 
     
    109109 
    110110        /// <summary> 
    111         /// The global instance of the EntropySource Manager 
    112         /// </summary> 
    113         public EntropySourceRegistrar EntropySourceRegistrar { get; private set; } 
    114  
    115         /// <summary> 
    116         /// The global instance of the PRNG Manager. 
    117         /// </summary> 
    118         public PrngRegistrar PrngRegistrar { get; private set; } 
    119  
    120         /// <summary> 
    121         /// The global instance of the Erasure method Manager. 
    122         /// </summary> 
    123         public ErasureMethodRegistrar ErasureMethodRegistrar { get; private set; } 
    124  
    125         /// <summary> 
    126         /// The global instance of the Erasure target Manager. 
    127         /// </summary> 
    128         public ErasureTargetRegistrar ErasureTargetRegistrar { get; private set; } 
    129  
    130         /// <summary> 
    131         /// The global instance of the File System manager. 
    132         /// </summary> 
    133         public FileSystemRegistrar FileSystemRegistrar { get; private set; } 
    134  
    135         /// <summary> 
    136111        /// Global instance of the Settings manager. 
    137112        /// </summary> 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/Eraser.Plugins.csproj

    r2352 r2357  
    6868    <Compile Include="Host.cs" /> 
    6969    <Compile Include="Properties\AssemblyInfo.cs" /> 
     70    <Compile Include="Registrars\EntropySourceRegistrar.cs" /> 
     71    <Compile Include="Registrars\ErasureMethodRegistrar.cs" /> 
     72    <Compile Include="Registrars\ErasureTargetFactoryRegistrar.cs" /> 
     73    <Compile Include="Registrars\FileSystemRegistrar.cs" /> 
     74    <Compile Include="Registrars\PrngRegistrar.cs" /> 
    7075  </ItemGroup> 
    7176  <ItemGroup> 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/EntropySource.cs

    r2352 r2357  
    33 * Copyright 2008-2010 The Eraser Project 
    44 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 
    5  * Modified By: Kasra Nassiri <cjax@users.sourceforge.net> 
     5 * Modified By: 
    66 *  
    77 * This file is part of Eraser. 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/ErasureMethod.cs

    r2352 r2357  
    128128 
    129129            //Randomize. 
    130             Prng rand = ManagerLibrary.Instance.PrngRegistrar[ManagerLibrary.Settings.ActivePrng]; 
     130            Prng rand = Host.Instance.Prngs[ManagerLibrary.Settings.ActivePrng]; 
    131131            for (int i = 0; i < result.Length; ++i) 
    132132            { 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/ErasureTarget.cs

    r2352 r2357  
    2929 
    3030using Eraser.Util; 
    31 using Eraser.Manager; 
    3231 
    3332namespace Eraser.Plugins.ExtensionPoints 
     
    4645                Method = ErasureMethodRegistrar.Default; 
    4746            else 
    48                 Method = ManagerLibrary.Instance.ErasureMethodRegistrar[methodGuid]; 
     47                Method = Host.Instance.ErasureMethods[methodGuid]; 
    4948        } 
    5049 
     
    7271            Method = ErasureMethodRegistrar.Default; 
    7372        } 
    74  
    75         /// <summary> 
    76         /// The task which owns this target. 
    77         /// </summary> 
    78         public Task Task { get; internal set; } 
    7973 
    8074        /// <summary> 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/FileSystem.cs

    r2352 r2357  
    2626 
    2727using System.IO; 
     28 
    2829using Eraser.Util; 
    2930 
     
    4647        { 
    4748            //Get the PRNG we are going to use 
    48             Prng prng = ManagerLibrary.Instance.PrngRegistrar[ManagerLibrary.Settings.ActivePrng]; 
     49            Prng prng = Host.Instance.Prngs[ManagerLibrary.Settings.ActivePrng]; 
    4950 
    5051            //Initialsie the base name, if any. 
     
    135136                List<string> entries = new List<string>( 
    136137                    ManagerLibrary.Settings.PlausibleDeniabilityFiles); 
    137                 Prng prng = ManagerLibrary.Instance.PrngRegistrar[ManagerLibrary.Settings.ActivePrng]; 
     138                Prng prng = Host.Instance.Prngs[ManagerLibrary.Settings.ActivePrng]; 
    138139                do 
    139140                { 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/ExtensionPoints/Prng.cs

    r2352 r2357  
    33 * Copyright 2008-2010 The Eraser Project 
    44 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 
    5  * Modified By: Kasra Nassiri <cjax@users.sourceforge.net> 
    65 * Modified By: 
    76 *  
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/Host.cs

    r2355 r2357  
    2929 
    3030using Eraser.Util; 
     31using Eraser.Plugins.ExtensionPoints; 
    3132 
    3233namespace Eraser.Plugins 
     
    6061 
    6162        /// <summary> 
    62         /// Initialises the Plugins library. Call <see cref="Host.Load"/> when object 
     63        /// Initialises the Plugins library. This allows you to specify the registrars 
     64        /// in charge of every extension point defined. 
     65        ///  
     66        /// Call <see cref="Host.Load"/> when object 
    6367        /// initialisation is complete. 
    6468        /// </summary> 
     69        /// <param name="entropySources">The Entropy Source registrar to use.</param> 
     70        /// <param name="prngs">The PRNG registrar to use.</param> 
     71        /// <param name="erasureMethods">The Erasure Methods registrar to use.</param> 
     72        /// <param name="erasureTargetFactories">The Erasure Target Factories registrar to use.</param> 
     73        /// <param name="fileSystems">The File System registrar to use.</param> 
    6574        /// <remarks>Call <see cref="Host.Instance.Dispose"/> when exiting.</remarks> 
    66         public static void Initialise() 
    67         { 
    68             new DefaultHost(); 
     75        public static void Initialise(Registrar<EntropySource> entropySources, 
     76            Registrar<Prng> prngs, Registrar<ErasureMethod> erasureMethods, 
     77            FactoryRegistrar<ErasureTarget> erasureTargetFactories, 
     78            Registrar<FileSystem> fileSystems) 
     79        { 
     80            new DefaultHost(entropySources, prngs, erasureMethods, erasureTargetFactories, 
     81                fileSystems); 
    6982        } 
    7083 
     
    7285        /// Constructor. Sets the global Plugin Host instance. 
    7386        /// </summary> 
     87        /// <param name="entropySources">The Entropy Source registrar to use.</param> 
     88        /// <param name="prngs">The PRNG registrar to use.</param> 
     89        /// <param name="erasureMethods">The Erasure Methods registrar to use.</param> 
     90        /// <param name="erasureTargetFactories">The Erasure Target Factories registrar to use.</param> 
     91        /// <param name="fileSystems">The File System registrar to use.</param> 
    7492        /// <see cref="Host.Instance"/> 
    75         protected Host() 
     93        protected Host(Registrar<EntropySource> entropySources, 
     94            Registrar<Prng> prngs, Registrar<ErasureMethod> erasureMethods, 
     95            FactoryRegistrar<ErasureTarget> erasureTargetFactories, 
     96            Registrar<FileSystem> fileSystems) 
    7697        { 
    7798            if (Instance != null) 
     
    79100                    "exist at any one point of time."); 
    80101            Instance = this; 
     102 
     103            EntropySources = entropySources; 
     104            Prngs = prngs; 
     105            ErasureMethods = erasureMethods; 
     106            ErasureTargetFactories = erasureTargetFactories; 
     107            FileSystems = fileSystems; 
    81108        } 
    82109 
     
    89116            private set; 
    90117        } 
     118 
     119        #region Plugin Loading and Management 
    91120 
    92121        /// <summary> 
     
    144173                PluginLoaded(sender, e); 
    145174        } 
     175 
     176        #endregion 
     177 
     178        #region Type Registrars 
     179 
     180        /// <summary> 
     181        /// The global instance of the EntropySource Manager 
     182        /// </summary> 
     183        public Registrar<EntropySource> EntropySources 
     184        { 
     185            get; 
     186            private set; 
     187        } 
     188 
     189        /// <summary> 
     190        /// The global instance of the PRNG Manager. 
     191        /// </summary> 
     192        public Registrar<Prng> Prngs 
     193        { 
     194            get; 
     195            private set; 
     196        } 
     197 
     198        /// <summary> 
     199        /// The global instance of the Erasure method Manager. 
     200        /// </summary> 
     201        public Registrar<ErasureMethod> ErasureMethods 
     202        { 
     203            get; 
     204            private set; 
     205        } 
     206 
     207        /// <summary> 
     208        /// The global instance of the Erasure target Manager. 
     209        /// </summary> 
     210        public FactoryRegistrar<ErasureTarget> ErasureTargetFactories 
     211        { 
     212            get; 
     213            private set; 
     214        } 
     215 
     216        /// <summary> 
     217        /// The global instance of the File System manager. 
     218        /// </summary> 
     219        public Registrar<FileSystem> FileSystems 
     220        { 
     221            get; 
     222            private set; 
     223        } 
     224 
     225        #endregion 
    146226    } 
    147227 
     
    154234        /// Constructor. 
    155235        /// </summary> 
    156         public DefaultHost() : base() 
     236        public DefaultHost(Registrar<EntropySource> entropySources, 
     237            Registrar<Prng> prngs, Registrar<ErasureMethod> erasureMethods, 
     238            FactoryRegistrar<ErasureTarget> erasureTargetFactories, 
     239            Registrar<FileSystem> fileSystems) 
     240            : base(entropySources, prngs, erasureMethods, erasureTargetFactories, fileSystems) 
    157241        { 
    158242            //Specify additional places to load assemblies from 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/Registrars/ErasureMethodRegistrar.cs

    r2352 r2357  
    1 /*  
     1/*  
    22 * $Id$ 
    3  * Copyright 2008-2010 The Eraser Project 
     3 * Copyright 2008-2011 The Eraser Project 
    44 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 
    55 * Modified By: 
     
    2222using System; 
    2323using System.Collections.Generic; 
     24using System.Linq; 
    2425using System.Text; 
    2526 
    26 using System.Reflection; 
    27 using System.IO; 
    28  
    2927using Eraser.Util; 
    30 using Eraser.Plugins; 
    3128using Eraser.Plugins.ExtensionPoints; 
    3229 
    33 namespace Eraser.Manager 
     30namespace Eraser.Plugins.Registrars 
    3431{ 
    3532    /// <summary> 
     
    8683        #endregion 
    8784    } 
    88  
    89     public class ErasureMethodRegistrationEventArgs : EventArgs 
    90     { 
    91         /// <summary> 
    92         /// Constructor. 
    93         /// </summary> 
    94         /// <param name="value">The GUID of the newly registered/unregistered 
    95         /// erasure method.</param> 
    96         public ErasureMethodRegistrationEventArgs(Guid value) 
    97         { 
    98             Guid = value; 
    99         } 
    100  
    101         /// <summary> 
    102         /// The GUID of the newly registsered/unregistered erasure method. 
    103         /// </summary> 
    104         public Guid Guid { get; private set; } 
    105     } 
    10685} 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/Registrars/FileSystemRegistrar.cs

    r2352 r2357  
    11/*  
    22 * $Id$ 
    3  * Copyright 2008-2010 The Eraser Project 
     3 * Copyright 2008-2011 The Eraser Project 
    44 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 
    55 * Modified By:  
     
    2222using System; 
    2323using System.Collections.Generic; 
     24using System.Linq; 
    2425using System.Text; 
    2526 
    26 using Eraser.Util; 
    27 using Eraser.Plugins; 
    2827using Eraser.Plugins.ExtensionPoints; 
    2928 
    30 namespace Eraser.Manager 
     29namespace Eraser.Plugins.Registrars 
    3130{ 
    3231    public class FileSystemRegistrar : Registrar<FileSystem> 
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/Registrars/PrngRegistrar.cs

    r2352 r2357  
    1 /*  
     1/*  
    22 * $Id$ 
    3  * Copyright 2008-2010 The Eraser Project 
     3 * Copyright 2008-2011 The Eraser Project 
    44 * Original Author: Joel Low <lowjoel@users.sourceforge.net> 
    5  * Modified By: Kasra Nassiri <cjax@users.sourceforge.net> 
    65 * Modified By: 
    76 *  
     
    2322using System; 
    2423using System.Collections.Generic; 
     24using System.Linq; 
    2525using System.Text; 
    2626 
    27 using System.Threading; 
    28 using System.Security.Cryptography; 
    29 using System.Runtime.InteropServices; 
    30 using System.Diagnostics; 
    31 using System.Reflection; 
    32 using System.IO; 
    33 using Microsoft.Win32.SafeHandles; 
    34  
    35 using Eraser.Util; 
    36 using Eraser.Plugins; 
    3727using Eraser.Plugins.ExtensionPoints; 
    3828 
    39 namespace Eraser.Manager 
     29namespace Eraser.Plugins.Registrars 
    4030{ 
    4131    /// <summary> 
Note: See TracChangeset for help on using the changeset viewer.