Esempio n. 1
0
        public void Start()
        {
            try
            {
                ExternalStoreItem item = null;
                if (_Options != null)
                {
                    item = _Options.GetCurrentOption();
                }
                if (item != null)
                {
                    if (item.ExternalStoreJob != null)
                    {
                        FixUpJob(item.ExternalStoreJob);
                        Scheduler.SubmitJob(item.ExternalStoreJob, new Action <Job>(ExternalStore));
                    }

                    if (item.CleanJob != null)
                    {
                        FixUpJob(item.CleanJob);
                        Scheduler.SubmitJob(item.CleanJob, new Action <Job>(Clean));
                    }
                }
            }
            catch (Exception ex)
            {
                DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "Exception: JobManager.Start(): " + ex.Message);
            }
        }
Esempio n. 2
0
        public static void StartExternalStoreJobs(ExternalStoreAddinConfigAbstract addinExternalStoreAddinConfig, string addinFriendlyName)
        {
            ExternalStoreItem item = null;

            if (Options != null)
            {
                item = Options.GetCurrentOption();
            }
            if ((item != null) && (addinExternalStoreAddinConfig != null) && (item.ExternalStoreAddinConfig.Equals(addinExternalStoreAddinConfig)))
            {
                ICrud crud = item.ExternalStoreAddinConfig.GetCrudInterface();
                crud.Initialize();
                DataAccessServiceLocator.Register <ICrud>(crud);
                DataAccessServiceLocator.Register <ICrud>(crud, crud.ExternalStoreGuid);

                StorageConfigManager = new StorageModuleConfigurationManager(true);
                StorageConfigManager.Load(ServiceDirectory);
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(_serviceDirectory);
                IExternalStoreDataAccessAgent      externalStoreAgent;
                if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                {
                    externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, _displayName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
                }
                else
                {
                    externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>();
                }

                IStorageDataAccessAgent storageAgent;
                if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
                {
                    storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, _displayName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(storageAgent);
                }
                else
                {
                    storageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
                }

                string sDebug = string.Format("{0}: Module.StartOrStopAddin()  -- new JobManager()", addinFriendlyName);
                ExternalStorePresenter.MyDumpExternalStoreOptions(sDebug, Options);
                JobManager = new JobManager(Options, externalStoreAgent, storageAgent, ServiceName, StorageConfigManager.GetStorageAddInsSettings());

                JobManager.ExternalStoreGuid = item.ExternalStoreAddinConfig.Guid;

                if (IsLicenseValid())
                {
                    sDebug = string.Format("{0}: Module.StartOrStopAddin()  -- JobManager.Start", addinFriendlyName);
                    DicomUtilities.DebugString(DebugStringOptions.ShowCounter, sDebug);
                    JobManager.Start();
                }
            }
        }