コード例 #1
0
ファイル: Hl7Client.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="parentActor">Parent Actor Name - (containing actor).</param>
        /// <param name="actorName">Destination Actor Name.</param>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">HL7 Configuration.</param>
        public Hl7Client(BaseActor parentActor, ActorName actorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config)
            : base(parentActor, actorName)
        {
            _hl7ThreadForHl7Client = new Hl7ThreadForHl7Client(this);
            DvtkHighLevelInterface.Common.Threads.ThreadManager threadManager = new DvtkHighLevelInterface.Common.Threads.ThreadManager();
            _hl7ThreadForHl7Client.Initialize(threadManager);
            _hl7ThreadForHl7Client.Options.UseResultsFileNameIndex = true;
            _hl7ThreadForHl7Client.Options.SessionId = config.SessionId;
            _hl7ThreadForHl7Client.Options.Identifier = String.Format("From_{0}_To_{1}",
                ParentActor.ActorName.TypeId,
                ActorName.TypeId);

            _triggerQueue = System.Collections.Queue.Synchronized(new System.Collections.Queue());
            _config = config;

            if (commonConfig.ResultsDirectory != System.String.Empty)
            {
                if (commonConfig.ResultsSubdirectory != System.String.Empty)
                {
                    _hl7ThreadForHl7Client.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory + "\\" + commonConfig.ResultsSubdirectory);
                }
                else
                {
                    _hl7ThreadForHl7Client.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory);
                }
            }

            // Set up the HL7 Validation Profile Store
            if ((commonConfig.Hl7ProfileDirectory != System.String.Empty) &&
                (commonConfig.Hl7ProfileStoreName != System.String.Empty))
            {
                _hl7ProfileStore = new Hl7ProfileStore(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.Hl7ProfileDirectory), commonConfig.Hl7ProfileStoreName);
            }

            // Set up the HL7 Validation Context
            if (commonConfig.Hl7ValidationContextFilename != System.String.Empty)
            {
                _hl7ValidationContext = new Hl7ValidationContext(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.Hl7ValidationContextFilename));
            }

            // Set up the validation Web Service
            if (commonConfig.NistWebServiceUrl != System.String.Empty)
            {
                _nistWebServiceClient = new NistWebServiceClient(commonConfig.NistWebServiceUrl);
            }
        }
コード例 #2
0
        /// <summary>
        /// Class constructor.
        /// </summary>
        /// <param name="parentActor">Parent Actor Name - (containing actor).</param>
        /// <param name="actorName">Destination Actor Name.</param>
        /// <param name="commonConfig">Common Configuration.</param>
        /// <param name="config">HL7 Configuration.</param>
        public Hl7Client(BaseActor parentActor, ActorName actorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config) : base(parentActor, actorName)
        {
            _hl7ThreadForHl7Client = new Hl7ThreadForHl7Client(this);
            DvtkHighLevelInterface.Common.Threads.ThreadManager threadManager = new DvtkHighLevelInterface.Common.Threads.ThreadManager();
            _hl7ThreadForHl7Client.Initialize(threadManager);
            _hl7ThreadForHl7Client.Options.UseResultsFileNameIndex = true;
            _hl7ThreadForHl7Client.Options.SessionId  = config.SessionId;
            _hl7ThreadForHl7Client.Options.Identifier = String.Format("From_{0}_To_{1}",
                                                                      ParentActor.ActorName.TypeId,
                                                                      ActorName.TypeId);

            _triggerQueue = System.Collections.Queue.Synchronized(new System.Collections.Queue());
            _config       = config;


            if (commonConfig.ResultsDirectory != System.String.Empty)
            {
                if (commonConfig.ResultsSubdirectory != System.String.Empty)
                {
                    _hl7ThreadForHl7Client.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory + "\\" + commonConfig.ResultsSubdirectory);
                }
                else
                {
                    _hl7ThreadForHl7Client.Options.ResultsDirectory = RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.ResultsDirectory);
                }
            }

            // Set up the HL7 Validation Profile Store
            if ((commonConfig.Hl7ProfileDirectory != System.String.Empty) &&
                (commonConfig.Hl7ProfileStoreName != System.String.Empty))
            {
                _hl7ProfileStore = new Hl7ProfileStore(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.Hl7ProfileDirectory), commonConfig.Hl7ProfileStoreName);
            }

            // Set up the HL7 Validation Context
            if (commonConfig.Hl7ValidationContextFilename != System.String.Empty)
            {
                _hl7ValidationContext = new Hl7ValidationContext(RootedBaseDirectory.GetFullPathname(commonConfig.RootedBaseDirectory, commonConfig.Hl7ValidationContextFilename));
            }

            // Set up the validation Web Service
            if (commonConfig.NistWebServiceUrl != System.String.Empty)
            {
                _nistWebServiceClient = new NistWebServiceClient(commonConfig.NistWebServiceUrl);
            }
        }
コード例 #3
0
ファイル: Hl7QueryServer.cs プロジェクト: ewcasas/DVTK
 /// <summary>
 /// Class constructor.
 /// </summary>
 /// <param name="parentActor">Parent Actor Name - (containing actor).</param>
 /// <param name="actorName">Destination Actor Name.</param>
 /// <param name="commonConfig">Common Configuration.</param>
 /// <param name="config">HL7 Configuration.</param>
 public Hl7QueryServer(BaseActor parentActor, ActorName actorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config)
     : base(parentActor, actorName, commonConfig, config)
 {
 }
コード例 #4
0
 /// <summary>
 /// Class constructor.
 /// </summary>
 /// <param name="parentActor">Parent Actor Name - (containing actor).</param>
 /// <param name="actorName">Destination Actor Name.</param>
 /// <param name="commonConfig">Common Configuration.</param>
 /// <param name="config">HL7 Configuration.</param>
 public Hl7QueryServer(BaseActor parentActor, ActorName actorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config) : base(parentActor, actorName, commonConfig, config)
 {
 }
コード例 #5
0
ファイル: ClientServerFactory.cs プロジェクト: ewcasas/DVTK
		/// <summary>
		/// Create a Hl7 Server of the given type.
		/// </summary>
		/// <param name="hl7ServerType">Hl7 Server Type - enum.</param>
		/// <param name="toActor">To Actor instance.</param>
		/// <param name="fromActorName">From Actor Name.</param>
		/// <param name="commonConfig">Common Configuration.</param>
		/// <param name="config">HL7 Configuration.</param>
		/// <returns>Hl7 Server.</returns>
		public static Hl7Server CreateHl7Server(Hl7ServerTypeEnum hl7ServerType, BaseActor toActor, ActorName fromActorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config)
		{
			Hl7Server hl7Server = null;

			switch (hl7ServerType)
			{
				case Hl7ServerTypeEnum.Hl7QueryServer:
					hl7Server = new Hl7QueryServer(toActor, fromActorName, commonConfig, config);
					break;
				case Hl7ServerTypeEnum.Hl7Server:
					hl7Server = new Hl7Server(toActor, fromActorName, commonConfig, config);
					break;
				case Hl7ServerTypeEnum.Unknown:
				default:
					break;
			}

			return hl7Server;
		}
コード例 #6
0
ファイル: ClientServerFactory.cs プロジェクト: ewcasas/DVTK
		/// <summary>
		/// Create an Hl7 Client of the given type.
		/// </summary>
		/// <param name="hl7ClientType">Hl7 Client Type - enum.</param>
		/// <param name="fromActor">From Actor instance.</param>
		/// <param name="toActorName">To Actor Name.</param>
		/// <param name="commonConfig">Common Configuration.</param>
		/// <param name="config">HL7 Configuration.</param>
		/// <returns>Hl7 Client.</returns>
		public static Hl7Client CreateHl7Client(Hl7ClientTypeEnum hl7ClientType, BaseActor fromActor, ActorName toActorName, CommonConfig commonConfig, Hl7PeerToPeerConfig config)
		{
			Hl7Client hl7Client = null;

			switch (hl7ClientType)
			{
				case Hl7ClientTypeEnum.Hl7Client:
					hl7Client = new Hl7Client(fromActor, toActorName, commonConfig, config);
					break;
				case Hl7ClientTypeEnum.Unknown:
				default:
					break;
			}

			return hl7Client;
		}
コード例 #7
0
ファイル: IheFrameworkConfig.cs プロジェクト: ewcasas/DVTK
        /// <summary>
        /// Load the Actor Configuration into the Integration Profile.
        /// </summary>
        /// <param name="configurationFilename">Configuration Filename</param>
        public void Load(System.String configurationFilename)
        {
            _actorConfigCollection = new ActorConfigCollection();
            _peerToPeerConfigCollection = new BasePeerToPeerConfigCollection();

            try
            {
                XmlTextReader reader = new XmlTextReader(configurationFilename);
                while (reader.EOF == false)
                {
                    reader.ReadStartElement("IheIntegrationProfile");
                    _profileName = reader.ReadElementString("IntegrationProfileName");
                    _commonConfig.RootedBaseDirectory = reader.ReadElementString("RootedBaseDirectory");
                    _commonConfig.ResultsDirectory = reader.ReadElementString("ResultsDirectory");

                    // read OverwriteResults - added later - some config files may not contain this parameter
                    reader.ReadString();
                    if (reader.Name == "OverwriteResults")
                    {
                        System.String overwriteResults = reader.ReadElementString("OverwriteResults");
                        if (overwriteResults == "True")
                        {
                            _commonConfig.OverwriteResults = true;
                        }
                        else
                        {
                            _commonConfig.OverwriteResults = false;
                        }
                    }

                    _commonConfig.CredentialsFilename = reader.ReadElementString("CredentialsFilename");
                    _commonConfig.CertificateFilename = reader.ReadElementString("CertificateFilename");
                    _commonConfig.NistWebServiceUrl = reader.ReadElementString("NistWebServiceUrl");
                    _commonConfig.Hl7ProfileDirectory = reader.ReadElementString("Hl7ProfileDirectory");
                    _commonConfig.Hl7ProfileStoreName = reader.ReadElementString("Hl7ProfileStoreName");
                    _commonConfig.Hl7ValidationContextFilename = reader.ReadElementString("Hl7ValidationContextFilename");
                    System.String interactive = reader.ReadElementString("Interactive");
                    if (interactive == "True")
                    {
                        _commonConfig.Interactive = true;
                    }
                    else
                    {
                        _commonConfig.Interactive = false;
                    }

                    while ((reader.IsStartElement()) &&
                        (reader.Name == "ActorConfiguration"))
                    {
                        reader.ReadStartElement("ActorConfiguration");
                        reader.ReadStartElement("ActorName");
                        ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                        System.String id = reader.ReadElementString("ActorId");
                        ActorName actorName = new ActorName(actorType, id);
                        reader.ReadEndElement();
                        ActorConfigStateEnum configState = ActorConfigState.ConfigStateEnum(reader.ReadElementString("ConfigState"));
                        ActorConfig actorConfig = new ActorConfig(actorName, configState);
                        _actorConfigCollection.Add(actorConfig);
                        reader.ReadEndElement();
                    }

                    while ((reader.IsStartElement()) &&
                        ((reader.Name == "DicomPeerToPeerConfiguration") ||
                        (reader.Name == "Hl7PeerToPeerConfiguration")))
                    {
                        if (reader.Name == "DicomPeerToPeerConfiguration")
                        {
                            DicomPeerToPeerConfig dicomPeerToPeerConfig = new DicomPeerToPeerConfig();

                            reader.ReadStartElement("DicomPeerToPeerConfiguration");
                            reader.ReadStartElement("FromActor");
                            reader.ReadStartElement("ActorName");
                            ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            System.String id = reader.ReadElementString("ActorId");
                            ActorName actorName = new ActorName(actorType, id);
                            dicomPeerToPeerConfig.FromActorName = actorName;
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.FromActorAeTitle = reader.ReadElementString("AeTitle");
                            reader.ReadEndElement();
                            reader.ReadStartElement("ToActor");
                            reader.ReadStartElement("ActorName");
                            actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            id = reader.ReadElementString("ActorId");
                            actorName = new ActorName(actorType, id);
                            dicomPeerToPeerConfig.ToActorName = actorName;
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.ToActorAeTitle = reader.ReadElementString("AeTitle");
                            dicomPeerToPeerConfig.ToActorIpAddress = reader.ReadElementString("IpAddress");
                            reader.ReadEndElement();
                            dicomPeerToPeerConfig.PortNumber = UInt16.Parse(reader.ReadElementString("PortNumber"));
                            System.String secureConnection = reader.ReadElementString("SecureConnection");
                            if (secureConnection == "True")
                            {
                                dicomPeerToPeerConfig.SecureConnection = true;
                            }
                            else
                            {
                                dicomPeerToPeerConfig.SecureConnection = false;
                            }

                            // read AutoValidate - added later - some config files may not contain this parameter
                            reader.ReadString();
                            if (reader.Name == "AutoValidate")
                            {
                                System.String autoValidate = reader.ReadElementString("AutoValidate");
                                if (autoValidate == "True")
                                {
                                    dicomPeerToPeerConfig.AutoValidate = true;
                                }
                                else
                                {
                                    dicomPeerToPeerConfig.AutoValidate = false;
                                }
                            }

                            dicomPeerToPeerConfig.ActorOption1 = reader.ReadElementString("ActorOption1");
                            dicomPeerToPeerConfig.ActorOption2 = reader.ReadElementString("ActorOption2");
                            dicomPeerToPeerConfig.ActorOption3 = reader.ReadElementString("ActorOption3");
                            dicomPeerToPeerConfig.SessionId = UInt16.Parse(reader.ReadElementString("SessionId"));
                            dicomPeerToPeerConfig.SourceDataDirectory = reader.ReadElementString("SourceDataDirectory");
                            dicomPeerToPeerConfig.StoreDataDirectory = reader.ReadElementString("StoreDataDirectory");
                            System.String storeData = reader.ReadElementString("StoreData");
                            if (storeData == "True")
                            {
                                dicomPeerToPeerConfig.StoreData = true;
                            }
                            else
                            {
                                dicomPeerToPeerConfig.StoreData = false;
                            }

                            reader.ReadStartElement("DefinitionFiles");

                            bool readingDefinitionFiles = true;
                            while (readingDefinitionFiles == true)
                            {
                                dicomPeerToPeerConfig.AddDefinitionFile(reader.ReadElementString("DefinitionFile"));
                                reader.Read();
                                if ((reader.NodeType == XmlNodeType.EndElement) &&
                                    (reader.Name == "DefinitionFiles"))
                                {
                                    reader.Read();
                                    readingDefinitionFiles = false;
                                }
                            }

                            _peerToPeerConfigCollection.Add(dicomPeerToPeerConfig);

                            reader.ReadEndElement();
                        }
                        else
                        {
                            Hl7PeerToPeerConfig hl7PeerToPeerConfig = new Hl7PeerToPeerConfig();

                            reader.ReadStartElement("Hl7PeerToPeerConfiguration");
                            reader.ReadStartElement("FromActor");
                            reader.ReadStartElement("ActorName");
                            ActorTypeEnum actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            System.String id = reader.ReadElementString("ActorId");
                            ActorName actorName = new ActorName(actorType, id);
                            hl7PeerToPeerConfig.FromActorName = actorName;
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.FromActorAeTitle = reader.ReadElementString("AeTitle");
                            reader.ReadEndElement();
                            reader.ReadStartElement("ToActor");
                            reader.ReadStartElement("ActorName");
                            actorType = ActorTypes.TypeEnum(reader.ReadElementString("ActorType"));
                            id = reader.ReadElementString("ActorId");
                            actorName = new ActorName(actorType, id);
                            hl7PeerToPeerConfig.ToActorName = actorName;
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.ToActorAeTitle = reader.ReadElementString("AeTitle");
                            hl7PeerToPeerConfig.ToActorIpAddress = reader.ReadElementString("IpAddress");
                            reader.ReadEndElement();
                            hl7PeerToPeerConfig.PortNumber = UInt16.Parse(reader.ReadElementString("PortNumber"));
                            hl7PeerToPeerConfig.MessageDelimiters.FromString(reader.ReadElementString("MessageDelimiters"));
                            System.String secureConnection = reader.ReadElementString("SecureConnection");
                            if (secureConnection == "True")
                            {
                                hl7PeerToPeerConfig.SecureConnection = true;
                            }
                            else
                            {
                                hl7PeerToPeerConfig.SecureConnection = false;
                            }

                            // read AutoValidate - added later - some config files may not contain this parameter
                            reader.ReadString();
                            if (reader.Name == "AutoValidate")
                            {
                                System.String autoValidate = reader.ReadElementString("AutoValidate");
                                if (autoValidate == "True")
                                {
                                    hl7PeerToPeerConfig.AutoValidate = true;
                                }
                                else
                                {
                                    hl7PeerToPeerConfig.AutoValidate = false;
                                }
                            }

                            hl7PeerToPeerConfig.ActorOption1 = reader.ReadElementString("ActorOption1");
                            hl7PeerToPeerConfig.ActorOption2 = reader.ReadElementString("ActorOption2");
                            hl7PeerToPeerConfig.ActorOption3 = reader.ReadElementString("ActorOption3");
                            hl7PeerToPeerConfig.SessionId = UInt16.Parse(reader.ReadElementString("SessionId"));

                            _peerToPeerConfigCollection.Add(hl7PeerToPeerConfig);

                            reader.ReadEndElement();
                        }
                    }

                    reader.ReadEndElement();
                }

                reader.Close();
            }
            catch (System.Exception e)
            {
                System.String message = System.String.Format("Failed to read configuration file: \"{0}\". Error: \"{1}\"", configurationFilename, e.Message);
                throw new System.SystemException(message, e);
            }
        }