Exemplo n.º 1
0
 /// <summary>
 /// Stores settings for a plug-in.
 /// </summary>
 /// <param name="pPluginGUID">The plug-in GUID</param>
 /// <param name="pSettings">The settings.</param>
 public void set(Guid pPluginGUID, PluginSettings pSettings)
 {
     if (pSettings == null)
     {
         throw new ArgumentNullException("pSettings", @"Settings can not be null.");
     }
     _settings[pPluginGUID] = pSettings;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public JobFactory(string pName, PluginSettings pSettings)
        {
            Name = pName;

            _settings = pSettings;

            Jobs = new Dictionary<Guid, iJob>();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Allows the plug-in to create the required jobs.
        /// </summary>
        public void Create(iJobFactory pJobFactory, PluginSettings pPluginSettings)
        {
            _logger.Fine("Creating jobs.");

            EmailSettings settings = (EmailSettings)pPluginSettings;
            iEventFactory eventFactory = ObjectFactory.GetInstance<iEventFactory>();

            iTaskCollection tasks = ObjectFactory.Container.GetInstance<iTaskCollection>();
            tasks.Add(ObjectFactory.Container.GetInstance<EmailTask>());
            pJobFactory.Create("Status", "status", tasks, new EmailContextFactory(eventFactory), new DailyState(settings.Hour));
        }
Exemplo n.º 4
0
 /// <summary>
 /// Replaces the settings in storage with new settings, or
 /// adds settings to the storage.
 /// </summary>
 /// <param name="pPluginGUID">The plug-in GUID.</param>
 /// <param name="pSettings">The settings object.</param>
 public void Store(Guid pPluginGUID, PluginSettings pSettings)
 {
     lock (_settings)
     {
         if (_settings.ContainsKey(pPluginGUID))
         {
             throw new StorageException("Settings for plug-in already stored. [{0}]", pPluginGUID);
         }
         _settings.Add(pPluginGUID, pSettings);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// Constructor
        /// </summary>
        protected JobContext([NotNull] PluginSettings pPluginSettings,
                             [CanBeNull] iDataSource pDataSource,
                             [NotNull] iEventFactory pEventFactory)
        {
            if (pPluginSettings == null)
            {
                throw new ArgumentNullException("pPluginSettings");
            }
            if (pEventFactory == null)
            {
                throw new ArgumentNullException("pEventFactory");
            }

            Source = pDataSource;
            PluginSettings = pPluginSettings;
            _eventFactory = pEventFactory;

            _eventRecorder = null;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Job(
            Guid pParentID,
            PluginSettings pSettings,
            string pPlugin,
            string pName,
            string pCode,
            iTaskCollection pTasks,
            iJobContextFactory pJobContextFactory,
            iEventFactory pEventFactory,
            iJobState pJobState,
            int pMaxErrors = 0)
        {
            _settings = pSettings;
            _jobContextFactory = pJobContextFactory;
            _jobState = pJobState;
            _eventDelay = new AutoResetEvent(false);

            _isRunning = false;
            _isSuspended = false;

            Tasks = pTasks;
            ParentID = pParentID;
            Plugin = pPlugin;
            Name = pName;
            Code = pCode;
            ID = Guid.NewGuid();
            State = eSTATE.NONE;

            _eventFactory = pEventFactory;

            Errors = 0;
            MaxErrors = pMaxErrors;
            TimeStamp = DateTime.Now;
            ThreadID = 0;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Allows the plug-in to start up using a custom configuration.
        /// </summary>
        /// <param name="pPluginSettings"></param>
        public void StartUp(PluginSettings pPluginSettings)
        {
            _logger.Fine("Starting up.");

            Dependencies.Bootstrap(ObjectFactory.Container);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Used to create a job context.
 /// </summary>
 public JobContext Create(PluginSettings pPluginSettings)
 {
     return new EmailContext(pPluginSettings, new EventFactory());
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor
 /// </summary>
 public EmailContext(PluginSettings pPluginSettings, iEventFactory pEventFactory)
     : base(pPluginSettings, null, pEventFactory)
 {
 }