Beispiel #1
0
        public List <DataCollector> GetCollectors(ICollectionTimeRetriever tr)
        {
            List <DataCollector> collectors = new List <DataCollector>();

            // We want to get the collectors in the same order presented to us by the
            // retriever because they're in priority order.
            long?id = tr.GetNextID();

            while (id != null)
            {
                // First, check our own collectors to see if this collector is one of ours
                DataCollector dc = Collectors.Find(c => c.Context.ID.ID == id);
                if (dc == null)
                {
                    // Not one of ours, so see if it belongs to one of our children
                    foreach (Device dev in Devices)
                    {
                        dc = dev.Collectors.Find(c => c.Context.ID.ID == id);
                        if (dc != null)
                        {
                            break;
                        }
                    }
                }

                if (dc != null)
                {
                    collectors.Add(dc);
                }
                else
                {
                    m_log.ErrorFormat("GetCollectors: unable to find collector {0}", id);
                }

                id = tr.GetNextID();
            }

            return(collectors);
        }