示例#1
0
        /// <summary>  Gets the global ISubscriber message handler registered with the Agent for
        /// the specified SIF object type.
        ///
        /// </summary>
        ///  <param name="context">The SIF context to look up the ReportPublisher for.
        /// The default implementaion of Agent only returns handlers for the  SIF default
        /// context.</param>
        /// <param name="objectType">A SifDtd constant identifying a SIF Data Object type
        /// (e.g. <c>SifDtd.STUDENTPERSONAL</c>)
        ///
        /// </param>
        /// <returns> The ISubscriber registered for this object type by the agent when
        /// it called the <c>setSubscriber</c> method, or <c>null</c>
        /// if no ISubscriber has been registered for the specified object type.
        /// </returns>
        public virtual ISubscriber GetSubscriber(SifContext context, IElementDef objectType)
        {
            ISubscriber s = null;

            if (SifContext.DEFAULT.Equals(context))
            {
                s = fSubs[objectType];
                if (s == null)
                {
                    s = fSubs[SifDtd.SIF_MESSAGE];
                }
            }
            return(s);
        }
示例#2
0
        /// <summary>
        /// Gets the global QueryResults message handler registered with the Agent for the specified SIF object type.
        /// </summary>
        /// <param name="context">The SIF context to look up the QueryResults handler for.
        /// The default implementation of Agent only returns handlers for
        /// SIFContext.DEFAULT</param>
        /// <param name="objectType">The QueryResults object registered for this object type by the
        /// agent when it called the <code>setQueryResults</code> method, or
        /// <code>null</code> if no QueryResults object has been registered
        /// for the specified object type.</param>
        /// <returns></returns>
        public virtual IQueryResults GetQueryResults(SifContext context, IElementDef objectType)
        {
            IQueryResults q = null;

            if (SifContext.DEFAULT.Equals(context))
            {
                q = (IQueryResults)fQueryResults[objectType];
                if (q == null)
                {
                    q = (IQueryResults)fQueryResults[SifDtd.SIF_MESSAGE];
                }
            }
            return(q);
        }
示例#3
0
 /// <summary>
 /// Evaluates the native wrapped value of this object to see if
 /// it equals the value of the compared object, using a case-insensitive comparison
 /// </summary>
 /// <param name="o"></param>
 /// <returns></returns>
 public override bool Equals(Object o)
 {
     if (this == o)
     {
         return(true);
     }
     if ((o != null) && (o is SifContext))
     {
         SifContext compared = (SifContext)o;
         return
             (StringComparer.InvariantCultureIgnoreCase.Compare
                  (fContextName, compared.fContextName) == 0);
     }
     return(false);
 }
示例#4
0
        /// <summary>  Gets the global IPublisher message handler registered with the Agent for the
        /// specified SIF object type.</summary>
        /// <param name="context">The SIF context to look up the ReportPublisher for.
        /// The default implementaion of Agent only returns handlers for the  SIF default
        /// context.</param>/// <param name="objectType">A SifDtd constant identifying a SIF Data Object type
        /// (e.g. <c>SifDtd.STUDENTPERSONAL</c>)
        ///
        /// </param>
        /// <returns> The IPublisher message handler registered for this object type by the
        /// agent when it called the <c>setPublisher</c> method, or <c>null</c> if
        /// no IPublisher has been registered for the specified object type.
        /// </returns>
        public virtual IPublisher GetPublisher(SifContext context, IElementDef objectType)
        {
            IPublisher p = null;

            if (SifContext.DEFAULT.Equals(context))
            {
                p = (IPublisher)fPubs[objectType];
                if (p == null)
                {
                    p = (IPublisher)fPubs[SifDtd.SIF_MESSAGE];
                }
            }

            return(p);
        }
示例#5
0
        /// <summary>
        /// Creates a SIFContext object with the given name. If the name
        /// matches a context name already defined by the ADK, the existing context will
        /// be returned.
        /// </summary>
        /// <param name="contextName"></param>
        /// <returns></returns>
        public static SifContext Create(String contextName)
        {
            if (contextName == null ||
                contextName.Length == 0 ||
                contextName == SIF_DEFAULT ||  //optimized
                contextName.ToLower().Equals(SIF_DEFAULT.ToLower()))
            {
                return(DEFAULT);
            }

            // Determine if the context is already defined
            SifContext returnValue;

            if (!sDefinedContexts.TryGetValue(contextName, out returnValue))
            {
                returnValue = new SifContext(contextName);
                sDefinedContexts[contextName] = returnValue;
            }

            return(returnValue);
        }
示例#6
0
 public override ISubscriber GetSubscriber(SifContext context,IElementDef objectType)
 {
     return fLogger;
 }
示例#7
0
 public override IQueryResults GetQueryResults(SifContext context, IElementDef objectType)
 {
     return fLogger;
 }
示例#8
0
 static SifContext()
 {
     DEFAULT          = new SifContext(SIF_DEFAULT);
     sDefinedContexts = new Dictionary <String, SifContext>();
 }
示例#9
0
 /// <summary>  Gets the global ISubscriber message handler registered with the Agent for 
 /// the specified SIF object type.
 /// 
 /// </summary>
 ///  <param name="context">The SIF context to look up the ReportPublisher for.
 /// The default implementaion of Agent only returns handlers for the  SIF default
 /// context.</param>
 /// <param name="objectType">A SifDtd constant identifying a SIF Data Object type
 /// (e.g. <c>SifDtd.STUDENTPERSONAL</c>)
 /// 
 /// </param>
 /// <returns> The ISubscriber registered for this object type by the agent when
 /// it called the <c>setSubscriber</c> method, or <c>null</c> 
 /// if no ISubscriber has been registered for the specified object type.
 /// </returns>
 public virtual ISubscriber GetSubscriber( SifContext context, IElementDef objectType )
 {
     ISubscriber s = null;
     if ( SifContext.DEFAULT.Equals( context ) )
     {
         s = fSubs[objectType];
         if ( s == null )
         {
             s = fSubs[SifDtd.SIF_MESSAGE];
         }
     }
     return s;
 }
示例#10
0
 /// <summary>
 /// Gets the global QueryResults message handler registered with the Agent for the specified SIF object type.
 /// </summary>
 /// <param name="context">The SIF context to look up the QueryResults handler for.
 /// The default implementation of Agent only returns handlers for 
 /// SIFContext.DEFAULT</param>
 /// <param name="objectType">The QueryResults object registered for this object type by the
 /// agent when it called the <code>setQueryResults</code> method, or 
 /// <code>null</code> if no QueryResults object has been registered
 /// for the specified object type.</param>
 /// <returns></returns>
 public virtual IQueryResults GetQueryResults( SifContext context, IElementDef objectType )
 {
     IQueryResults q = null;
     if ( SifContext.DEFAULT.Equals( context ) )
     {
         q = (IQueryResults) fQueryResults[objectType];
         if ( q == null )
         {
             q = (IQueryResults) fQueryResults[SifDtd.SIF_MESSAGE];
         }
     }
     return q;
 }
示例#11
0
        /// <summary>  Gets the global IPublisher message handler registered with the Agent for the 
        /// specified SIF object type.</summary>
        /// <param name="context">The SIF context to look up the ReportPublisher for.
        /// The default implementaion of Agent only returns handlers for the  SIF default
        /// context.</param>/// <param name="objectType">A SifDtd constant identifying a SIF Data Object type
        /// (e.g. <c>SifDtd.STUDENTPERSONAL</c>)
        /// 
        /// </param>
        /// <returns> The IPublisher message handler registered for this object type by the 
        /// agent when it called the <c>setPublisher</c> method, or <c>null</c> if 
        /// no IPublisher has been registered for the specified object type.
        /// </returns>
        public virtual IPublisher GetPublisher( SifContext context, IElementDef objectType )
        {
            IPublisher p = null;
            if ( SifContext.DEFAULT.Equals( context ) )
            {
                p = (IPublisher) fPubs[objectType];
                if ( p == null )
                {
                    p = (IPublisher) fPubs[SifDtd.SIF_MESSAGE];
                }
            }

            return p;
        }
示例#12
0
        /// <summary>
        /// Creates a SIFContext object with the given name. If the name
        /// matches a context name already defined by the ADK, the existing context will
        /// be returned.
        /// </summary>
        /// <param name="contextName"></param>
        /// <returns></returns>
        public static SifContext Create(String contextName)
        {
            if (contextName == null ||
                 contextName.Length == 0 ||
                 contextName == SIF_DEFAULT || //optimized
                 contextName.ToLower().Equals(SIF_DEFAULT.ToLower()))
            {
                return DEFAULT;
            }

            // Determine if the context is already defined
            SifContext returnValue;
            if( !sDefinedContexts.TryGetValue( contextName, out returnValue ) )
            {
                returnValue = new SifContext(contextName);
                sDefinedContexts[contextName] = returnValue;
            }

            return returnValue;
        }
示例#13
0
 static SifContext()
 {
     DEFAULT = new SifContext(SIF_DEFAULT);
     sDefinedContexts = new Dictionary<String, SifContext>();
 }