public RestoreProcess(ExternalStoreOptions options, string externalStoreGuid, string serviceName, StorageAddInsConfiguration storageAddinsConfiguration) { _Options = options; FriendlyName = _Options.GetFriendlyName(externalStoreGuid); _serviceName = serviceName; _storageAddinsConfiguration = storageAddinsConfiguration; }
public void Start(ExternalStoreOptions options) { 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)); } _Options = options; } } catch (Exception ex) { DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "Exception: JobManager.Start(ExternalStoreOptions options): " + ex.Message); } }
public ExternalStoreProcess(ExternalStoreOptions options, string externalStoreGuid, string serviceName) { _Options = options; _externalStoreGuid = externalStoreGuid; FriendlyName = _Options.GetFriendlyName(externalStoreGuid); _serviceName = serviceName; }
public CleanProcess(ExternalStoreOptions options, string externalStoreGuid, string serviceName, StorageAddInsConfiguration storageSettings) { _Options = options; FriendlyName = _Options.GetFriendlyName(externalStoreGuid); _serviceName = serviceName; _storageSettings = storageSettings; }
// Called when the external store addin is loaded by the PACSFramework // Registers the ICrud interface used by this external store add-in // If this external store add-in is currently active, this method starts the JobManager for this addin public override void Load(string serviceDirectory, string displayName) { // Open 'advanced.config' which contains all settings for CSStorageServerManger.exe addins (including this ExternalStore SampleAddin) AdvancedSettings settings = AdvancedSettings.Open(serviceDirectory); _serviceDirectory = serviceDirectory; try { Type[] extraTypes = new[] { typeof(SampleConfiguration) }; Options = settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", extraTypes); if (Options == null) { Options = new ExternalStoreOptions(); } ICrud thisCrud = Options.GetCrud(SampleGuid); if (thisCrud != null) { DataAccessServiceLocator.Register(thisCrud, thisCrud.ExternalStoreGuid); } } catch (Exception e) { if (Options == null) { Options = new ExternalStoreOptions(); } Logger.Global.Error(Source, e.Message); } ExternalStore.Addin.Module.StartExternalStoreJobs(SampleExternalStoreAddinConfig, "Sample"); }
public JobManager(ExternalStoreOptions options, IExternalStoreDataAccessAgent externalStoreAgent, IStorageDataAccessAgent storeAgent, string serviceName, StorageAddInsConfiguration storageSettings) { _Options = options; _externalStoreAgent = externalStoreAgent; _storageAgent = storeAgent; _serviceName = serviceName; _storageSettings = storageSettings; }
static ExternalStorage() { AdvancedSettings _Settings = null; List <Type> _extraTypeList = new List <Type>(); const string _Name = "ExternalStore"; ExternalStoreOptions _Options = null; if (_Settings == null) { try { string storageServerServicePath = ConfigurationManager.AppSettings.Get("storageServerServicePath"); if (Directory.Exists(storageServerServicePath)) { storageServerServicePath = ServiceUtils.MapConfigPath(storageServerServicePath); _Settings = AdvancedSettings.Open(storageServerServicePath); _Settings.RefreshSettings(); } } catch (System.Configuration.ConfigurationErrorsException) { // This can occur when connection a v19 HTML Medical Web Viewer to a v18 CSStorageServerManager.exe database // The v18 CSStorageServerManager.exe does not have support for external store } catch (Exception e) { throw new ServiceException("Possible invalid storageServerServicePath specified. " + e.Message); } if (_Settings != null) { _Options = _Settings.GetAddInCustomData <ExternalStoreOptions>(_Name, "ExternalStoreOptions", _extraTypeList.ToArray()); } if (_Options == null) { _Options = new ExternalStoreOptions(); } _Options.RegisterAllExternalStoreAddins(); ExternalStoreItem item = _Options.GetCurrentOption(); if (item != null) { ICrud crud = item.ExternalStoreAddinConfig.GetCrudInterface(); DataAccessServiceLocator.Register <ICrud>(crud); DataAccessServiceLocator.Register <ICrud>(crud, crud.ExternalStoreGuid); } else { DataAccessServiceLocator.Register <ICrud>(new DefaultCrud()); } } }
// If the external store options changed through the CSStorageServerManager.exe UI this event is fired // and the DICOM Listening service needs to be notified to reinitialize the external store settings. public static void ExternalStoreSettingsChanged() { AdvancedSettings settings = AdvancedSettings.Open(_serviceDirectory); if (settings != null) { settings.RefreshSettings(); Type[] extraTypes = new Type[] { typeof(SampleConfiguration) }; Options = settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", extraTypes); ExternalStore.Addin.Module.StartExternalStoreJobs(SampleExternalStoreAddinConfig, "Sample"); } }
/// <summary> /// Initiates the 'External Store' operation. /// </summary> private static void ExternalStore(string externalStoreGuid) { try { IExternalStoreDataAccessAgent externalStoreAgent; IStorageDataAccessAgent storageAgent; System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory); // External Store Agent if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>()) { externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>(); DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent); } else { externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>(); } // Storage Agent if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>()) { storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IStorageDataAccessAgent>(); DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(storageAgent); } else { storageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>(); } if (externalStoreAgent != null && storageAgent != null) { ExternalStoreOptions options = Module.Options; if (options != null) { new ExternalStoreProcess(Module.Options, externalStoreGuid, Module.ServiceName).Run(externalStoreAgent, storageAgent); } else { string message = string.Format("Before using the 'External Store' tools, you must configure an 'External Store' addin and then click the 'Apply' button."); Logger.Global.SystemMessage(LogType.Error, message, Module.ServiceName); } } } catch (Exception e) { Logger.Global.SystemLogException(e, Module.ServiceName); } }
public override void Load(string serviceDirectory, string displayName) { string msg = string.Format("serviceDirectory:{0} displayName:{1}", serviceDirectory, displayName); DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "Module.Load() -- JobManager.Start" + msg); AdvancedSettings settings = AdvancedSettings.Open(serviceDirectory); _serviceDirectory = serviceDirectory; DicomServer server = ServiceLocator.Retrieve <DicomServer>(); ServiceName = server.Name; try { Type[] extraTypes = new Type[] { typeof(AzureConfiguration) }; Options = settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", extraTypes); ExternalStorePresenter.MyDumpExternalStoreOptions("Module.Load() -- settings.GetAddInCustomData()", Options); if (Options == null) { Options = new ExternalStoreOptions(); } ICrud thisCrud = Options.GetCrud(AzureGuid); if (thisCrud != null) { DataAccessServiceLocator.Register <ICrud>(thisCrud, thisCrud.ExternalStoreGuid); } } catch (Exception e) { DicomUtilities.DebugString(DebugStringOptions.ShowCounter, "*** Exception: Module.Load() settings.GetAddInCustomData" + e.Message); if (Options == null) { Options = new ExternalStoreOptions(); } Logger.Global.Error(Source, e.Message); } ExternalStore.Addin.Module.StartExternalStoreJobs(AzureExternalStoreAddinConfig, "Azure"); }
public override void Load(string serviceDirectory, string displayName) { _serviceDirectory = serviceDirectory; _displayName = displayName; DicomServer server = ServiceLocator.Retrieve <DicomServer>(); if (server != null) { _serverAE = server.AETitle; _serviceName = server.Name; } _settings = AdvancedSettings.Open(serviceDirectory); Type[] extraTypes = null;// Options = Settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", extraTypes); StorageConfigManager = new StorageModuleConfigurationManager(true); StorageConfigManager.Load(ServiceDirectory); }
public static void StopExternalStoreJobs() { if (JobManager != null) { string sDebug = string.Format("Module.StopExternalStoreJobs -- JobManager.Stop"); DicomUtilities.DebugString(DebugStringOptions.ShowCounter, sDebug); JobManager.Stop(); } // No cloud storage Settings.RefreshSettings(); Options = Settings.GetAddInCustomData <ExternalStoreOptions>(ExternalStorePresenter._Name, "ExternalStoreOptions", null); string s = string.Format("{0}: Module.StopExternalStoreJobs()", ExternalStorePresenter._Name); ExternalStorePresenter.MyDumpExternalStoreOptions(s, Options); if (Options.ExternalStoreIndex == -1) { DataAccessServiceLocator.Register <ICrud>(new DefaultCrud()); } }