Ejemplo n.º 1
0
        /// <summary>   Get a ServerLog instance with the specified ID.
        ///
        /// This method is intended to be called internally by the Adk. You
        /// should call the <c>Adk.getServerLog</c>, <c>Agent.getServerLog</c>,
        /// or <c>Zone.getServerLog</c> methods to obtain a ServerLog instance
        /// rather than directly calling this method.
        ///
        /// </summary>
        /// <param name="id">The ID identifying the ServerLog to return
        /// </param>
        /// <param name="zone">The zone that is currently in scope</param>
        /// <returns> A ServerLog instance
        /// </returns>
        public static ServerLog GetInstance(string id,
                                            IZone zone)
        {
            if (id == null)
            {
                throw new ArgumentException("ID cannot be null");
            }

            ServerLog log = null;

            if (!sInstances.TryGetValue(id, out log))
            {
                log            = new ServerLog(id, zone);
                sInstances[id] = log;
            }

            return(log);
        }
Ejemplo n.º 2
0
        /// <summary>   Protected constructor; clients must call <c>getInstance</c></summary>
        private ServerLog(string id,
                          IZone zone)
        {
            fID   = id;
            fZone = zone;

            //	Determine the parent
            if (id.Equals(Adk.LOG_IDENTIFIER))
            {
                fParent = null;
            }
            else if (id.Equals(Agent.LOG_IDENTIFIER))
            {
                fParent = GetInstance(Adk.LOG_IDENTIFIER, zone);
            }
            else
            {
                fParent = GetInstance(Agent.LOG_IDENTIFIER, zone);
            }
        }