Esempio n. 1
0
        /// <summary>
        /// Initiates the reset process.
        /// </summary>
        /// <param name="range">The date range to reset.</param>
        private void Reset(DateRange range)
        {
            try
            {
                IForwardDataAccessAgent forwardAgent;

                if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>())
                {
                    System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);
                    forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(forwardAgent);
                }
                else
                {
                    forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>();
                }

                if (forwardAgent != null)
                {
                    new ResetProcess(Module.ServerAE).Run(forwardAgent, range);
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemMessage(LogType.Error, e.Message, Module.ServerAE);
            }
        }
Esempio n. 2
0
        public void InitializeDatabase()
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);

            if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
            {
                _ConfigView        = new AeManagementDataAccessConfigurationView(configuration, null, Module.ServiceName);
                _aeManagementAgent = DataAccessFactory.GetInstance(_ConfigView).CreateDataAccessAgent <IAeManagementDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(_aeManagementAgent);
            }
            else
            {
                _aeManagementAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
            {
                _StorageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(_StorageAgent);
            }
            else
            {
                _StorageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Initiates the reset process.
        /// </summary>
        /// <param name="range">The date range to reset.</param>
        private static void Reset(DateRange range)
        {
            try
            {
                IExternalStoreDataAccessAgent externalStoreAgent;

                if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                {
                    System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);
                    externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
                }
                else
                {
                    externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>();
                }

                if (externalStoreAgent != null)
                {
                    new ResetProcess(Module.ServerAE).Run(externalStoreAgent, range);
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemLogException(e, Module.ServiceName);
            }
        }
Esempio n. 4
0
        private static void RegisterDataAccessAgents(string serviceDirectory, string serviceName)
        {
            if (!DataAccessServices.IsDataAccessServiceRegistered <ILoggingDataAccessAgent2> ( ))
            {
                ILoggingDataAccessAgent2 loggingDataAccess;


                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);
                loggingDataAccess = DataAccessFactory.GetInstance(new LoggingDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <ILoggingDataAccessAgent2> ( );

                DataAccessServices.RegisterDataAccessService <ILoggingDataAccessAgent2> (loggingDataAccess);
            }


            try
            {
                if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent> ( ))
                {
                    IOptionsDataAccessAgent optionsDataAccess;


                    System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);
                    optionsDataAccess = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IOptionsDataAccessAgent> ( );

                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent> (optionsDataAccess);
                }
            }
            catch (Exception)
            {
                // Workstation does not use IOptionsDataAccessAgent, so ignore if not registered
            }
        }
Esempio n. 5
0
        public override void AddServices( )
        {
            Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServiceDirectory);
            DicomServer   server        = ServiceLocator.Retrieve <DicomServer>();
            string        serviceName   = server.Name;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent> ( ))
            {
                IForwardDataAccessAgent dataAccess = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();

                DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent> (dataAccess);
            }

            RegisterGatewayServer( );

            RegisterForwardService( );

            SettingsChangedNotifier settingsChanged;

            if (!ServiceLocator.IsRegistered <SettingsChangedNotifier> ( ))
            {
                settingsChanged = new SettingsChangedNotifier(__Settings);

                ServiceLocator.Register <SettingsChangedNotifier> (settingsChanged);
            }
            else
            {
                settingsChanged = ServiceLocator.Retrieve <SettingsChangedNotifier> (  );
            }

            settingsChanged.SettingsChanged += new EventHandler(settingsChanged_SettingsChanged);

            settingsChanged.Enabled = true;
        }
Esempio n. 6
0
        static void RegisterDataAccessAgents(string serviceName)
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServiceDirectory);
            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent> ( ))
            {
                IStorageDataAccessAgent storageDataAccess = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IStorageDataAccessAgent> ( );

                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent> (storageDataAccess);

                DataAccess = storageDataAccess;
            }
            else
            {
                DataAccess = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IPermissionManagementDataAccessAgent> ( ))
            {
                try
                {
                    IPermissionManagementDataAccessAgent permissionsDataAccess = DataAccessFactory.GetInstance(new AePermissionManagementDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IPermissionManagementDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IPermissionManagementDataAccessAgent>(permissionsDataAccess);

                    PermissionsAgent = permissionsDataAccess;
                }
                catch (Exception)
                {
                }
            }
            else
            {
                PermissionsAgent = DataAccessServices.GetDataAccessService <IPermissionManagementDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent> ( ))
            {
                try
                {
                    IOptionsDataAccessAgent optionsDataAccess = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IOptionsDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent>(optionsDataAccess);
                }
                catch (Exception)
                {
                }
            }

            //TODO: Check if workstastion data access is registered if not then check if config information
            //is available. create only if config options available otherwise don't.
            //the database manager will use the ws dataAccess only if registered.
            //if ( !DataAccessServices.IsDataAccessServiceRegistered <IWorkstationDataAccess> ( ) )
            //{
            //   IOptionsDataAccessAgent optionsDataAccess = DataAccessFactory.GetInstance ( new OptionsDataAccessConfigurationView (configuration, null, serviceName) ).CreateDataAccessAgent <IOptionsDataAccessAgent> ( ) ;

            //   DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent> ( optionsDataAccess ) ;
            //}
        }
Esempio n. 7
0
        public static void RegisterInterfaces()
        {
#if TUTORIAL_CUSTOM_DATABASE
            // The 'RegisterInterfaces' method is implemented as part of the "Changing the LEAD HTML5 Medical Viewer to use a different database schema" tutorial.
            // For the tutorial, 'RegisterInterfaces' is used to register custom classes that you define to interact with a custom database.
            // For the shipping version, the 'RegisterInterfaces' does nothing
            //
            // Since the WCF services are stateless (below), this method is called before using any of the services.
            // The AddinsFactory class is used to generate the addins required by each of the services.
            // So the AddinsFactory constructor calls 'RegisterInterfaces' if it has not already been called.
            //
            // WCF Services:
            // * AuthenticationService
            // * ObjectRetrieveService
            // * PacsQueryService
            // * PACSRetrieveService
            // * StoreService
            //
            // The MyPatientInfo, MyStudyInfo, MySeriesInfo, and MyInstanceInfo classes are used for extracting DICOM data from a System.Data.DataRow.
            // The MyStorageSqlDbDataAccessAgent and MyStorageDataAccessConfigurationView classes are used for accessing your custom database
            // The MyPatient, MyStudy, MySeries, and MyInstance classes are used to generate the WHERE statement of the database query
            // For more details, see the "Changing the LEAD HTML5 Medical Viewer to use a different database schema" tutorial.

            if (!DataAccessServiceLocator.IsRegistered <IPatientInfo>())
            {
                DataAccessServiceLocator.Register <IPatientInfo>(new MyPatientInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <IStudyInfo>())
            {
                DataAccessServiceLocator.Register <IStudyInfo>(new MyStudyInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <ISeriesInfo>())
            {
                DataAccessServiceLocator.Register <ISeriesInfo>(new MySeriesInfo());
            }

            if (!DataAccessServiceLocator.IsRegistered <IInstanceInfo>())
            {
                DataAccessServiceLocator.Register <IInstanceInfo>(new MyInstanceInfo());
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent3>())
            {
                System.Configuration.Configuration configuration     = ServiceUtils.GetGlobalPacsConfig();
                IStorageDataAccessAgent3           storageDataAccess = DataAccessFactory.GetInstance(new MyStorageDataAccessConfigurationView(configuration, ServiceUtils.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent3>();
                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent3>(storageDataAccess);
            }

            RegisteredEntities.AddItem(RegisteredEntities.PatientEntityName, typeof(MyPatient));
            RegisteredEntities.AddItem(RegisteredEntities.StudyEntityName, typeof(MyStudy));
            RegisteredEntities.AddItem(RegisteredEntities.SeriesEntityName, typeof(MySeries));
            RegisteredEntities.AddItem(RegisteredEntities.InstanceEntityName, typeof(MyInstance));
#endif
        }
Esempio n. 8
0
        public Form1( )
        {
            InitializeComponent( );

            Messager.Caption = this.Text;

            if (!DatabaseLayer.IsDataAccessSettingsValid( ))
            {
                MessageBox.Show("Database settings is not valid. Please run the PACS Database Configuration Demo.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            _source        = new WorklistDataSource( );
            _databaseLayer = new DatabaseLayer(_source);
            _iodPath       = Application.StartupPath;

            _iodPath = Path.Combine(_iodPath, "CustomMWLIOD.xml");

            using (Stream iodStream = MWLCFindCommand.DefualtMWLIOD)
            {
                using (FileStream customIODStream = new FileStream(_iodPath, FileMode.Create))
                {
                    CopyTo(iodStream, customIODStream);
                }
            }

            _source.DatabaseTags.Add(new DatabaseDicomTags("Visit", "ServiceEpisodeDescription", DicomTag.ServiceEpisodeDescription));
            _source.DatabaseTags.Add(new DatabaseDicomTags("ScheduledProcedureStep", "CommentsOnTheScheduledProcedureStep", DicomTag.CommentsOnTheScheduledProcedureStep));
            _source.DatabaseTags.Add(new DatabaseDicomTags("Patient", "SmokingStatus", DicomTag.SmokingStatus));

            _worklistAgent = _databaseLayer.GetWorklistDataAgent( );

            DataAccessServices.RegisterDataAccessService <IWorklistDataAccessAgent> (_worklistAgent);

            databaseStatus1.ConnectionString = _databaseLayer.ConnectionString;
            databaseStatus1.ProviderName     = _databaseLayer.Provider;

            dicomTags1.SetSource(_source.DatabaseTags);
            worklistUpdate1.SetSource(_source.DatabaseTags);
            dicomQuery1.SetSource(_source.DatabaseTags, _iodPath);

            if (_databaseLayer.IsDatabaseUpdated())
            {
                try
                {
                    WorklistIODUpdater.UpdateIOD(_source.DatabaseTags, _iodPath);
                }
                catch (Exception exception)
                {
                    Messager.ShowError(this, "Error Updating the Modality Work-list IOD document.\n" + exception);
                }
            }

            UpdateDatabaseButton.Click += new EventHandler(UpdateDatabaseButton_Click);
        }
Esempio n. 9
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();
                }
            }
        }
Esempio n. 10
0
        /// <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);
            }
        }
Esempio n. 11
0
        private static T GetDataAccess <T>(DataAccessConfigurationView configView)
        {
            T service;

            if (!DataAccessServices.IsDataAccessServiceRegistered <T>())
            {
                service = DataAccessFactory.GetInstance(configView).CreateDataAccessAgent <T>();
                DataAccessServices.RegisterDataAccessService <T>(service);
            }
            else
            {
                service = DataAccessServices.GetDataAccessService <T>();
            }
            return(service);
        }
Esempio n. 12
0
        public static T GetAgent <T>(System.Configuration.Configuration configuration, DataAccessConfigurationView view)
        {
            T agent;

            if (!DataAccessServices.IsDataAccessServiceRegistered <T>())
            {
                agent = DataAccessFactory.GetInstance(view).CreateDataAccessAgent <T>();
                DataAccessServices.RegisterDataAccessService <T>(agent);
            }
            else
            {
                agent = DataAccessServices.GetDataAccessService <T>();
            }
            return(agent);
        }
Esempio n. 13
0
        public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory)
        {
            _AdvancedSettings = advancedSettings;
            _Settings         = Settings;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
            {
                _AccessAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServerDirectory), null, Settings.ServiceName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();

                DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(_AccessAgent);
            }

            _ConfigureDialog = new ConfigureDialog();
            _Presenter       = new ForwardManagerPresenter();
            _Presenter.RunView(_ConfigureDialog.View, _AdvancedSettings);
        }
Esempio n. 14
0
        static void RegisterDataAccessAgents(string serviceName)
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServiceDirectory);
            if (!DataAccessServices.IsDataAccessServiceRegistered <IWorklistDataAccessAgent> ( ))
            {
                IWorklistDataAccessAgent worklistDataAccess = DataAccessFactory.GetInstance(new WorklistDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IWorklistDataAccessAgent> ( );

                DataAccessServices.RegisterDataAccessService <IWorklistDataAccessAgent> (worklistDataAccess);

                DataAccess = worklistDataAccess;
            }
            else
            {
                DataAccess = DataAccessServices.GetDataAccessService <IWorklistDataAccessAgent>();
            }
        }
Esempio n. 15
0
        static void RegisterDataAccessAgents(string serviceDirectory, string serviceName)
        {
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);


            if (!DataAccessServices.IsDataAccessServiceRegistered <IDownloadJobsDataAccessAgent>())
            {
                try
                {
                    IDownloadJobsDataAccessAgent downloadDataAccess = DataAccessFactory.GetInstance(new DownloadJobsDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IDownloadJobsDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IDownloadJobsDataAccessAgent>(downloadDataAccess);
                }
                catch (Exception)
                {
                }
            }
        }
Esempio n. 16
0
        private static IUserManagementDataAccessAgent GetDataAccessAgent( )
        {
            IUserManagementDataAccessAgent datasetDataAccessAgent;


            if (!DataAccessServices.IsDataAccessServiceRegistered <IUserManagementDataAccessAgent>())
            {
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();
                datasetDataAccessAgent = DataAccessFactory.GetInstance(new UserManagementDataAccessConfigurationView(configuration, PacsProduct.ProductName, PacsProduct.ServiceName)).CreateDataAccessAgent <IUserManagementDataAccessAgent>();

                DataAccessServices.RegisterDataAccessService <IUserManagementDataAccessAgent>(datasetDataAccessAgent);
            }
            else
            {
                datasetDataAccessAgent = DataAccessServices.GetDataAccessService <IUserManagementDataAccessAgent>();
            }

            return(datasetDataAccessAgent);
        }
Esempio n. 17
0
        private static void Restore(string externalStoreGuid, DateRange range)
        {
            try
            {
                IExternalStoreDataAccessAgent externalStoreAgent;
                IStorageDataAccessAgent       storageAgent;

                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);

                if (!DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                {
                    externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
                }
                else
                {
                    externalStoreAgent = DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>();
                }

                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)
                {
                    StorageAddInsConfiguration storageAddinsConfiguration = Module.StorageConfigManager.GetStorageAddInsSettings();

                    new RestoreProcess(Module.Options, externalStoreGuid, Module.ServiceName, storageAddinsConfiguration).Run(externalStoreAgent, storageAgent, range);
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemLogException(e, Module.ServiceName);
            }
        }
Esempio n. 18
0
        public DicomFileDeleter()
        {
            try
            {
                if (!DataAccessServices.IsDataAccessServiceRegistered <IWorkstationDataAccessAgent>())
                {
                    wsAgent = DataAccessFactory.GetInstance(new WorkstationDataAccessConfigurationView(/*DicomDemoSettingsManager.GetGlobalPacsConfiguration(), PacsProduct.ProductName, null*/)).CreateDataAccessAgent <IWorkstationDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IWorkstationDataAccessAgent>(wsAgent);
                }
                else
                {
                    wsAgent = DataAccessServices.GetDataAccessService <IWorkstationDataAccessAgent>();
                }
            }
            catch
            {
                wsAgent = null;
            }
            _DeleteReferencedImagesOnImageDelete = true;
        }
Esempio n. 19
0
        /// <summary>
        /// Initiates the clean process.
        /// </summary>
        private void Clean()
        {
            try
            {
                IForwardDataAccessAgent forwardAgent;
                IStorageDataAccessAgent storageAgent;

                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);

                if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>())
                {
                    forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(forwardAgent);
                }
                else
                {
                    forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>();
                }

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

                if (forwardAgent != null && storageAgent != null)
                {
                    new CleanProcess(Module.Options, Module.ServerAE).Run(forwardAgent, storageAgent);
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemMessage(LogType.Error, e.Message, Module.ServerAE);
            }
        }
        private void InitializeDataAccess()
        {
            if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>())
            {
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();
                _forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, PacsProduct.ProductName, PacsProduct.ServiceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(_forwardAgent);
            }
            else
            {
                _forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>();
            }

            if (_forwardAgent != null)
            {
                _infoTimer      = new System.Threading.Timer(new System.Threading.TimerCallback(UpdateCount));
                VisibleChanged += new EventHandler(ForwardManagerConfigurationView_VisibleChanged);
                if (Visible)
                {
                    _infoTimer.Change(REFRESH_INTERVAL, REFRESH_INTERVAL);
                }
            }
        }
Esempio n. 21
0
        public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory)
        {
            _AdvancedSettings = advancedSettings;
            _Settings         = Settings;

            if (Settings != null)
            {
                Module.ServiceName = Settings.ServiceName;
            }

            try
            {
                IAeManagementDataAccessAgent aeManagementAgent;

                if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
                {
                    aeManagementAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServerDirectory), null, Settings.ServiceName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(aeManagementAgent);
                }
                else
                {
                    aeManagementAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
                }


                _autoCopyDlg       = new ConfigureDialog( );
                _autoCopyPresenter = new AutoCopyPresenter( );

                _autoCopyPresenter.RunView(_autoCopyDlg.AutoCopyView, advancedSettings);
            }
            catch (Exception e)
            {
                Logger.Global.Exception(Module.Source, e);
            }
        }
Esempio n. 22
0
        public void Initialize(AdvancedSettings advancedSettings, ServerSettings Settings, string ServerDirectory)
        {
            _AdvancedSettings = advancedSettings;
            _Settings         = Settings;

            try
            {
                IOptionsDataAccessAgent      optionsAgent;
                IAeManagementDataAccessAgent aeManagementAgent;


                if (!DataAccessServices.IsDataAccessServiceRegistered <IOptionsDataAccessAgent> ( ))
                {
                    optionsAgent = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServerDirectory), null, Settings.ServiceName)).CreateDataAccessAgent <IOptionsDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent>(optionsAgent);
                }

                if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent> ( ))
                {
                    aeManagementAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(ServerDirectory), null, Settings.ServiceName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();

                    DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(aeManagementAgent);
                }


                _patientUpdaterDlg       = new ConfigureDialog( );
                _patientUpdaterPresenter = new PatientUpdaterPresenter( );

                _patientUpdaterPresenter.RunView(_patientUpdaterDlg.PatientUpdaterConfigurationView, ServerDirectory);
            }
            catch (Exception e)
            {
                Logger.Global.Exception(Module.Source, e);
            }
        }
Esempio n. 23
0
        static void Main()
        {
            // Still want to let this application run with an expired license (as this is an enterprise level application), but in very a limited mode
            // For example, the user should be able to view the log
            //Support.SetLicense();
            //if (Support.KernelExpired)
            //   return;
            InitializeLicense();

            if (ProcessChecker.IsOnlyProcess(Shell.storageServerName))
            {
#if (LEADTOOLS_V20_OR_LATER)
                if (DemosGlobal.IsDotNet45OrLaterInstalled() == false)
                {
                    MessageBox.Show("To run this application, you must first install Microsoft .NET Framework 4.5 or later.",
                                    "Microsoft .NET Framework 4.5 or later Required",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation);
                    return;
                }
#endif
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                PacsProduct.ProductName = DicomDemoSettingsManager.ProductNameStorageServer;

                bool ok;

                string exeName = Path.GetFileNameWithoutExtension(Application.ExecutablePath);

                if (Demos.DemosGlobal.Is64Process( ))
                {
                    exeName += "64";
                }
                else
                {
                    exeName += "32";
                }

                Mutex m = new Mutex(true, exeName, out ok);

#if !TUTORIAL_CUSTOM_DATABASE && !LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE
                CheckPacsConfigDemo();
#endif

                string globalPacsConfigPath = DicomDemoSettingsManager.GlobalPacsConfigFullFileName;
                if (File.Exists(globalPacsConfigPath))
                {
                    try
                    {
                        if (false == UpgradeConfigFiles())
                        {
                            return;
                        }
                    }
                    catch (Exception ex)
                    {
                        string msg = string.Format("Upgrade Failed!\n\n{0}", ex.Message);
                        MessageBox.Show(msg, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }

                try
                {
                    string   message         = string.Empty;
                    string[] productsToCheck = new string[] { DicomDemoSettingsManager.ProductNameStorageServer };
                    bool     dbConfigured    = GlobalPacsUpdater.IsDbComponentsConfigured(productsToCheck, out message);

#if TUTORIAL_CUSTOM_DATABASE
                    // When manually configuring the storage server to use a different database schema, the helper funciton 'IsDbComponentsConfigured'
                    // will incorrectly detect that the database has not been configured.  In this case, set 'dbConfigured' to true.
                    // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial.
                    dbConfigured = true;
#endif

                    if (!dbConfigured &&
                        !RequestUserToConfigureDbSucess(message))
                    {
                        return;
                    }


#if !TUTORIAL_CUSTOM_DATABASE
                    if (!GlobalPacsUpdater.IsProductDatabaseUpTodate(DicomDemoSettingsManager.ProductNameStorageServer) &&
                        !RequestUserToUpgradeDbSucess( ))
                    {
                        return;
                    }
#endif

                    IOptionsDataAccessAgent            optionsAgent;
                    System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

                    if (!ok)
                    {
                        return;
                    }

                    optionsAgent = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IOptionsDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IOptionsDataAccessAgent>(optionsAgent);

                    if (Login(string.Empty, false))
                    {
//#if !DEBUG
                        SplashForm.ShowSplash();
// #endif
                        Shell shell = new Shell( );

                        shell.Run( );
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("The program failed to run with the following error:\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
#if LEADTOOLS_V19_OR_LATER
                    ProducerConsumerQueue.Instance.Shutdown(true);
#endif
                    m.Close( );
                }
            }
        }
Esempio n. 24
0
        private void RegisterDataAccessLayers( )
        {
#if (LEADTOOLS_V19_OR_LATER && !TUTORIAL_CUSTOM_DATABASE)
            IStorageDataAccessAgent3 storageAgent;
#else
            IStorageDataAccessAgent storageAgent;
#endif
            ILoggingDataAccessAgent2 loggingAgent;
            //IOptionsDataAccessAgent              optionsAgent ;
            IAeManagementDataAccessAgent         aeManagementAgent;
            IPermissionManagementDataAccessAgent permissionManagementAgent;
            IForwardDataAccessAgent forwardManagementAgent;

#if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)
            IExternalStoreDataAccessAgent externalStoreAgent;
#endif

#if (LEADTOOLS_V20_OR_LATER)
            IPatientRightsDataAccessAgent2 patientRightsAgent;
#endif


            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

#if TUTORIAL_CUSTOM_DATABASE
            // To use a custom database schema, you must create a data access configuration view that implements IDataAccessConfigurationView.
            // This helper class is used to create your custom data access agent.
            // For more details, see the "Changing the LEAD Medical Storage Server to use a different database schema" tutorial.

            storageAgent = DataAccessFactory.GetInstance(new MyStorageDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent> ( );
#elif (LEADTOOLS_V19_OR_LATER)
            storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent3> ( );
#else
            storageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent> ( );
#endif

            loggingAgent = DataAccessFactory.GetInstance(new LoggingDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <ILoggingDataAccessAgent2>();
            //optionsAgent = DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent<IOptionsDataAccessAgent>();
            aeManagementAgent         = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();
            permissionManagementAgent = DataAccessFactory.GetInstance(new AePermissionManagementDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IPermissionManagementDataAccessAgent>();
            forwardManagementAgent    = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IForwardDataAccessAgent>();
#if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)
            externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
#endif

#if (LEADTOOLS_V20_OR_LATER)
            patientRightsAgent = DataAccessFactory.GetInstance(new PatientRightsDataAccessConfigurationView(configuration, DicomDemoSettingsManager.ProductNameStorageServer, null)).CreateDataAccessAgent <IPatientRightsDataAccessAgent2>();
#endif

            DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent> (storageAgent);
            DataAccessServices.RegisterDataAccessService <ILoggingDataAccessAgent2> (loggingAgent);
            //DataAccessServices.RegisterDataAccessService<IOptionsDataAccessAgent>(optionsAgent);
            DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(aeManagementAgent);
            DataAccessServices.RegisterDataAccessService <IPermissionManagementDataAccessAgent>(permissionManagementAgent);
            DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(forwardManagementAgent);

#if (LEADTOOLS_V19_OR_LATER_MEDICAL_EXTERNAL_STORE) || (LEADTOOLS_V19_OR_LATER)
            DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
#endif

#if (LEADTOOLS_V20_OR_LATER)
            DataAccessServices.RegisterDataAccessService <IPatientRightsDataAccessAgent2>(patientRightsAgent);
#endif
        }
Esempio n. 25
0
        /// <summary>
        /// Initiates the forward process.
        /// </summary>
        private void Forward(string destinationAE)
        {
            try
            {
                IForwardDataAccessAgent      forwardAgent;
                IAeManagementDataAccessAgent aeAgent;

                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(Module.ServiceDirectory);

                if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>())
                {
                    forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IForwardDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(forwardAgent);
                }
                else
                {
                    forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>();
                }

                if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
                {
                    aeAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(configuration, null, Module.ServiceName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();
                    DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(aeAgent);
                }
                else
                {
                    aeAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
                }

                if (forwardAgent != null && aeAgent != null)
                {
                    AeInfoExtended ae = aeAgent.GetAeTitle(destinationAE);

                    if (ae != null)
                    {
#if LEADTOOLS_V20_OR_LATER
                        // Update dbo.AeInfo.LastAccessDate to Date.Now
                        ae.LastAccessDate = DateTime.Now;
                        aeAgent.Update(ae.AETitle, ae);
#endif

                        DicomScp  scp     = null;
                        IPAddress address = IPAddress.None;

                        if (!IPAddress.TryParse(ae.Address, out address))
                        {
                            IPHostEntry host = Dns.GetHostEntry(ae.Address);

                            if (host.AddressList.Length > 0)
                            {
                                address = host.AddressList[0];
                            }
                        }

                        if (address != IPAddress.None)
                        {
                            scp = new DicomScp(address, ae.AETitle, ae.Port)
                            {
                                Timeout = Module.Timeout
                            };

                            new ForwardProcess(Module.Options, Module.ServerAE).Run(scp, forwardAgent);
                        }
                        else
                        {
                            string message = string.Format("[Forwarder] Could resolve host name ({0}) not found on server", ae.Address);

                            Logger.Global.SystemMessage(LogType.Error, message, Module.ServerAE);
                        }
                    }
                    else
                    {
                        string message = string.Format("[Forwarder] AE title ({0}) not found on server", destinationAE);

                        Logger.Global.SystemMessage(LogType.Warning, message, Module.ServerAE);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Global.SystemMessage(LogType.Error, e.Message, Module.ServerAE);
            }
        }
Esempio n. 26
0
        internal static void RegisterServices(string serviceName)
        {
            if (!DataAccessServices.IsDataAccessServiceRegistered <IMediaCreationDataAccessAgent> ( ))
            {
                IMediaCreationDataAccessAgent mediaCreationService;

                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

                mediaCreationService = DataAccessFactory.GetInstance(new MediaCreationDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IMediaCreationDataAccessAgent> ( );

                DataAccessServices.RegisterDataAccessService <IMediaCreationDataAccessAgent> (mediaCreationService);
            }

            IStorageDataAccessAgent storageService;

            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent> ( ))
            {
                System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsConfiguration();

                storageService = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, serviceName)).CreateDataAccessAgent <IStorageDataAccessAgent>();

                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent> (storageService);
            }
            else
            {
                storageService = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent> ( );
            }

            if (!CommandRequestValidationManager.IsRegistered <CommandRequestDataSetValidator> ( ))
            {
                CommandRequestValidationManager.AddValidator(new CommandRequestDataSetValidator( ));
            }

            if (!CommandRequestValidationManager.IsRegistered <MediaCreationReferencedSopsValidator> ( ))
            {
                MediaCreationReferencedSopsValidator validator = new MediaCreationReferencedSopsValidator(storageService);


                validator.Enabled = AddInConfiguration.ValidateReferencedSopInstances;

                CommandRequestValidationManager.AddValidator(validator);
            }

            if (!DicomCommandFactory.IsCommandServiceRegistered(typeof(MediaNCreateCommand)))
            {
                DicomCommandFactory.RegisterCommandInitializationService(typeof(MediaNCreateCommand),
                                                                         new MediaNCreateCommandInitializationService( ));
            }

            if (!ServiceLocator.IsRegistered <MediaServicesState> ( ))
            {
                MediaServicesState servicesState;


                servicesState = new MediaServicesState( );

                servicesState.AutoCreationServiceEnabled     = MediaAutoCreationConfiguration.EnableAutoMediaCreation;
                servicesState.MediaMaintenanceServiceEnabled = MaintenanceConfiguration.Enabled;

                servicesState.AutoCreationServiceStateChanged     += new EventHandler(servicesState_AutoCreationServiceStateChanged);
                servicesState.MediaMaintenanceServiceStateChanged += new EventHandler(servicesState_MediaMaintenanceServiceStateChanged);

                ServiceLocator.Register <MediaServicesState> (servicesState);
            }

            if (!ServiceLocator.IsRegistered <SettingsChangedNotifier> ( ))
            {
                SettingsChangedNotifier configChangedNotifier = new SettingsChangedNotifier(_settings);

                configChangedNotifier.SettingsChanged += new EventHandler(configChangedNotifier_SettingsChanged);

                configChangedNotifier.Enabled = true;

                ServiceLocator.Register <SettingsChangedNotifier> (configChangedNotifier);
            }
        }
Esempio n. 27
0
        public override void Load(string serviceDirectory, string displayName)
        {
            IForwardDataAccessAgent      forwardAgent;
            IAeManagementDataAccessAgent aeAgent;
            IStorageDataAccessAgent      storageAgent;
            AdvancedSettings             settings = AdvancedSettings.Open(serviceDirectory);

            RegisterServerEvents(settings);
            _serviceDirectory = serviceDirectory;

            DicomServer server = ServiceLocator.Retrieve <DicomServer>();

            ServiceName = server.Name;
            _Timeout    = server.ClientTimeout <= 0 ? 30 : server.ClientTimeout;

            try
            {
                Options = settings.GetAddInCustomData <ForwardOptions>(ForwardManagerPresenter._addinName, "ForwardOptions");
                if (Options == null)
                {
                    Options = new ForwardOptions();
                }
            }
            catch (Exception e)
            {
                if (Options == null)
                {
                    Options = new ForwardOptions();
                }

                Logger.Global.Error(Source, e.Message);
            }

            StorageConfigManager = new StorageModuleConfigurationManager(true);
            StorageConfigManager.Load(ServiceDirectory);
            System.Configuration.Configuration configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);
            if (!DataAccessServices.IsDataAccessServiceRegistered <IForwardDataAccessAgent>())
            {
                forwardAgent = DataAccessFactory.GetInstance(new ForwardDataAccessConfigurationView(configuration, null, displayName)).CreateDataAccessAgent <IForwardDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IForwardDataAccessAgent>(forwardAgent);
            }
            else
            {
                forwardAgent = DataAccessServices.GetDataAccessService <IForwardDataAccessAgent>();
            }

            if (!DataAccessServices.IsDataAccessServiceRegistered <IAeManagementDataAccessAgent>())
            {
                aeAgent = DataAccessFactory.GetInstance(new AeManagementDataAccessConfigurationView(configuration, null, displayName)).CreateDataAccessAgent <IAeManagementDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IAeManagementDataAccessAgent>(aeAgent);
            }
            else
            {
                aeAgent = DataAccessServices.GetDataAccessService <IAeManagementDataAccessAgent>();
            }

            _aeManagementAgent = aeAgent;

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

            JobManager          = new JobManager(Options, forwardAgent, aeAgent, storageAgent);
            JobManager.ServerAE = _ServerAE;
            if (IsLicenseValid())
            {
                JobManager.Start();
            }
        }
Esempio n. 28
0
        public override void Load(string serviceDirectory, string displayName)
        {
            System.Configuration.Configuration configuration;
            DicomServer server = ServiceLocator.Retrieve <DicomServer>();

            ServiceDirectory = serviceDirectory;
            ServiceName      = server.Name;
            ServerAE         = server.AETitle;

            server.ServerSettingsChanged += new EventHandler(server_ServerSettingsChanged);
            StorageConfigManager          = new StorageModuleConfigurationManager(true);
            StorageConfigManager.Load(serviceDirectory);

            configuration = DicomDemoSettingsManager.GetGlobalPacsAddinsConfiguration(serviceDirectory);
            if (!DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent>())
            {
                StorageAgent = DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, null, displayName)).CreateDataAccessAgent <IStorageDataAccessAgent>();
                DataAccessServices.RegisterDataAccessService <IStorageDataAccessAgent>(StorageAgent);
            }
            else
            {
                StorageAgent = DataAccessServices.GetDataAccessService <IStorageDataAccessAgent>();
            }

            try
            {
                AdvancedSettings settings = AdvancedSettings.Open(ServiceDirectory);
                string           name     = Assembly.GetExecutingAssembly().GetName().Name;

                RegisterServerEvents(settings);
                Options = settings.GetAddInCustomData <PatientUpdaterOptions>(_AddIn, _Name);
                if (Options == null)
                {
                    Options = new PatientUpdaterOptions();
                }

                if (Options.EnableAutoUpdate)
                {
                    UpdateQueue = new AutoUpdateQueue(Options.AutoUpdateThreads);
                    UpdateQueue.InitializeDatabase();
                }
            }
            catch (Exception e)
            {
                if (Options == null)
                {
                    Options = new PatientUpdaterOptions();
                }

                Logger.Global.Error(Source, e.Message);
            }

            if (Options.EnableRetry)
            {
                if (string.IsNullOrEmpty(Module.Options.RetryDirectory))
                {
                    Module.Options.RetryDirectory = Path.Combine(ServiceDirectory, @"AutoUpdate\");
                }

                RetryProcessor = new AutoRetryProcessor(Options.RetryDirectory);
                RetryProcessor.Start(Options.RetrySeconds, Options.RetryDays);
            }
        }
Esempio n. 29
0
        //no overhead here since all services need these objects created anyway
        private void CreateSingletons()
        {
            System.Configuration.Configuration configuration = null;
            ConnectionStringSettings           cs            = null;
            ConnectionStringSettings           csMessageBus  = null;

            try
            {
                configuration = GetGlobalPacsConfig();
                if (null == configuration)
                {
                    cs = GetConnectionDefaults();
                }
                if (null == configuration && null == cs)
                {
                    throw new ServiceSetupException("Missing GlobalPacs.Config path information (and/or) missing the Connection strings configurations.");
                }

                csMessageBus = GetMessageBusConnection();

                if (null == csMessageBus)
                {
                    _messageBus = new Lazy <IMessagesBus>(() => new InMemoryMessagesBus());
                }
                else
                {
                    _messageBus = new Lazy <IMessagesBus>(() => new RebusSqlMessagesBus(csMessageBus.ConnectionString));
                }

                _storageAgent = new Lazy <IStorageDataAccessAgent3>(() =>
                {
                    if (DataAccessServices.IsDataAccessServiceRegistered <IStorageDataAccessAgent3>())
                    {
                        return(DataAccessServices.GetDataAccessService <IStorageDataAccessAgent3>());
                    }
                    else
                    {
                        if (null != configuration)
                        {
                            return(DataAccessFactory.GetInstance(new StorageDataAccessConfigurationView(configuration, ProductNameStorageServer, null)).CreateDataAccessAgent <IStorageDataAccessAgent3>());
                        }
                        else
                        {
                            return(createDataAccess <StorageDataAccessConfigurationView, IStorageDataAccessAgent3>(cs));
                        }
                    }
                });

                _loggingAgent = new Lazy <ILoggingDataAccessAgent>(() =>
                {
                    if (DataAccessServices.IsDataAccessServiceRegistered <ILoggingDataAccessAgent>())
                    {
                        return(DataAccessServices.GetDataAccessService <ILoggingDataAccessAgent>());
                    }
                    else
                    {
                        if (null != configuration)
                        {
                            return(DataAccessFactory.GetInstance(new LoggingDataAccessConfigurationView(configuration, ProductNameStorageServer, null)).CreateDataAccessAgent <ILoggingDataAccessAgent>());
                        }
                        else
                        {
                            return(createDataAccess <LoggingDataAccessConfigurationView, ILoggingDataAccessAgent>(cs));
                        }
                    }
                });

                //initialize external storage (slow)
                // (07.26.2019) Update for 85943: Call ExternalStorage.Startup() here for ExternalStorage (i.e. Cloud storage)
                ExternalStorage.Startup();

                _externalStoreAgent = new Lazy <IExternalStoreDataAccessAgent>(() =>
                {
                    if (DataAccessServices.IsDataAccessServiceRegistered <IExternalStoreDataAccessAgent>())
                    {
                        return(DataAccessServices.GetDataAccessService <IExternalStoreDataAccessAgent>());
                    }
                    else
                    {
                        IExternalStoreDataAccessAgent externalStoreAgent;
                        if (null != configuration)
                        {
                            externalStoreAgent = DataAccessFactory.GetInstance(new ExternalStoreDataAccessConfigurationView(configuration, ProductNameStorageServer, null)).CreateDataAccessAgent <IExternalStoreDataAccessAgent>();
                        }
                        else
                        {
                            externalStoreAgent = createDataAccess <ExternalStoreDataAccessConfigurationView, IExternalStoreDataAccessAgent>(cs);
                        }
                        DataAccessServices.RegisterDataAccessService <IExternalStoreDataAccessAgent>(externalStoreAgent);
                        return(externalStoreAgent);
                    }
                });

                _userManagementDataAccessAgent = new Lazy <IUserManagementDataAccessAgent4>(() =>
                {
                    if (null != configuration)
                    {
                        return(DataAccessFactory.GetInstance(new UserManagementDataAccessConfigurationView2(configuration, ProductNameStorageServer, null)).CreateDataAccessAgent <IUserManagementDataAccessAgent4>());
                    }
                    else
                    {
                        return(createDataAccess <UserManagementDataAccessConfigurationView2, IUserManagementDataAccessAgent4>(cs));
                    }
                });
                _permissionManagementDataAccessAgent = new Lazy <IPermissionManagementDataAccessAgent2>(() =>
                {
                    if (null != configuration)
                    {
                        return(DataAccessFactory.GetInstance(new PermissionManagementDataAccessConfigurationView(configuration, ProductNameStorageServer, null)).CreateDataAccessAgent <IPermissionManagementDataAccessAgent2>());
                    }
                    else
                    {
                        return(createDataAccess <PermissionManagementDataAccessConfigurationView, IPermissionManagementDataAccessAgent2>(cs));
                    }
                });
                _optionsDataAccessAgent = new Lazy <IOptionsDataAccessAgent>(() =>
                {
                    if (null != configuration)
                    {
                        return(DataAccessFactory.GetInstance(new OptionsDataAccessConfigurationView(configuration, ProductNameMedicalViewer, null)).CreateDataAccessAgent <IOptionsDataAccessAgent>());
                    }
                    else
                    {
                        return(createDataAccess <OptionsDataAccessConfigurationView, IOptionsDataAccessAgent>(cs));
                    }
                });
                _patientRightsDataAccess = new Lazy <IPatientRightsDataAccessAgent>(() =>
                {
                    if (null != configuration)
                    {
                        return(DataAccessFactory.GetInstance(new PatientRightsDataAccessConfigurationView(configuration, ProductNameMedicalViewer, null)).CreateDataAccessAgent <IPatientRightsDataAccessAgent>());
                    }
                    else
                    {
                        return(createDataAccess <PatientRightsDataAccessConfigurationView, IPatientRightsDataAccessAgent>(cs));
                    }
                });
                _downloadJobsDataAccessAgent = new Lazy <IDownloadJobsDataAccessAgent>(() =>
                {
                    if (null != configuration)
                    {
                        return(DataAccessFactory.GetInstance(new DownloadJobsDataAccessConfigurationView(configuration, ProductNameMedicalViewer, null)).CreateDataAccessAgent <IDownloadJobsDataAccessAgent>());
                    }
                    else
                    {
                        return(createDataAccess <DownloadJobsDataAccessConfigurationView, IDownloadJobsDataAccessAgent>(cs));
                    }
                });
                _monitorCalibrationDataAccessAgent = new Lazy <IMonitorCalibrationDataAccessAgent>(() =>
                {
                    if (null != configuration)
                    {
                        return(DataAccessFactory.GetInstance(new MonitorCalibrationDataAccessConfigurationView(configuration, ProductNameMedicalViewer, null)).CreateDataAccessAgent <IMonitorCalibrationDataAccessAgent>());
                    }
                    else
                    {
                        return(createDataAccess <MonitorCalibrationDataAccessConfigurationView, IMonitorCalibrationDataAccessAgent>(cs));
                    }
                });
                _templateDataAccessAgent = new Lazy <ITemplateDataAccessAgent>(() =>
                {
                    if (null != configuration)
                    {
                        return(DataAccessFactory.GetInstance(new TemplateDataAccessConfigurationView(configuration, ProductNameMedicalViewer, null)).CreateDataAccessAgent <ITemplateDataAccessAgent>());
                    }
                    else
                    {
                        return(createDataAccess <TemplateDataAccessConfigurationView, ITemplateDataAccessAgent>(cs));
                    }
                });

                _authorizedStorageDataAccessAgent = new Lazy <IAuthorizedStorageDataAccessAgent2>(() => new AuthorizedStorageDataAccessAgent(_storageAgent.Value, _patientRightsDataAccess.Value, _permissionManagementDataAccessAgent.Value));
                _dataCache          = new Lazy <Leadtools.Dicom.Imaging.IDataCacheProvider>(() => LTCachingCtrl.CreateCache(LTCachingCtrl.CacheSettings));
                _connectionSettings = new Lazy <ConnectionSettings>();
            }
            catch
            {
                throw new ServiceSetupException("Service component not registered");
            }
        }