예제 #1
0
        /// 
        /// <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);
 }