コード例 #1
0
ファイル: ParticipantFactory.cs プロジェクト: staxgr/ops
        /// 
        /// <param name="domain"></param>
        /// <param name="participantID"></param>
        internal Participant GetParticipant(Domain domain, string participantID)
        {
            string hashKey = domain.GetDomainID() + " " + participantID;

            if (!instances.ContainsKey(hashKey))
            {
                Participant newInst = new Participant(domain, participantID);
                Domain tDomain = newInst.getDomain();

                if (tDomain != null)
                {
                    instances.Add(hashKey, newInst);
                }
                else
                {
                    return null;
                }
            }
            return instances[hashKey];
        }
コード例 #2
0
ファイル: Participant.cs プロジェクト: staxgr/ops
 //---------------------------------------------------------------
 public Participant(string domainID, string participantID, string configFile)
 {
     Interlocked.Increment(ref safeInstanceCount);  ///TEST
     this.domainID = domainID;
     this.participantID = participantID;
     try
     {
         if (configFile == "")
         {
             this.config = OPSConfig.GetConfig();
             this.domain = this.config.GetDomain(domainID);
         } else
         {
             this.config = OPSConfig.GetConfig(configFile);
             this.domain = this.config.GetDomain(domainID);
         }
         if (this.domain != null)
         {
             this.inProcessTransport.Start();
             SetupCyclicThread();
         }
         else
         {
             Logger.ExceptionLogger.LogMessage(this.GetType().Name + ", Failed to find requested domain in configuration file");
             throw new System.Exception("Failed to find requested domain in configuration file");
         }
     }
     catch (IOException)
     {
         Logger.ExceptionLogger.LogMessage(this.GetType().Name + ", Configuration file missing");
         throw;
     }
     catch (Ops.FormatException)
     {
         Logger.ExceptionLogger.LogMessage(this.GetType().Name + ", Format error in configuration file");
         throw;
     }
 }
コード例 #3
0
 public void Add(Domain dom)
 {
     domains.Add(dom);
 }
コード例 #4
0
ファイル: Participant.cs プロジェクト: staxgr/ops
        public Participant(Domain domain, string participantID)
        {
            Interlocked.Increment(ref safeInstanceCount);  ///TEST
            this.domainID = domain.GetDomainID();
            this.participantID = participantID;

            this.domain = domain;

            this.inProcessTransport.Start();
            SetupCyclicThread();
        }
コード例 #5
0
ファイル: Participant.cs プロジェクト: staxgr/ops
 public static Participant GetInstance(Domain domain, string participantID)
 {
     return participantFactory.GetParticipant(domain, participantID);
 }