コード例 #1
0
 public DataParser(IOriginIdentityProvider iop, RawEntryParserChain chn, IRecieveEvents reciever)
 {
     if (reciever == null)
     {
         throw new InvalidOperationException("The reciever can not be null, the DataParser can not parse entries into a null reciever");
     }
     outwardBound = reciever;
     chain        = chn;
     originID     = iop;
 }
コード例 #2
0
        /// <summary>
        /// Quick way of returning a link by asking for it by a character.
        /// N - null entry parser.
        /// A - Allow all parser.
        /// F - Validating parser
        /// L - LegaccyFormat Parser
        /// T - FullyFormatted Parser
        /// </summary>
        /// <param name="c">The character represnenting the link to request</param>
        /// <returns></returns>
        private static RawEntryParserChainLink GetParserLinkByCharacterIdentity(char c, IOriginIdentityProvider oidp)
        {
            RawEntryParserChainLink result = null;

            if (c == NULL_LINK[0])
            {
                result = new RawEntryToNullLink();
            }
            else if (c == ALL_LINK[0])
            {
                result = new AllowAllParserLink();
            }
            else if (c == VAL_LINK[0])
            {
                result = new ValidatingNullProviderParserLink();
            }
            else if (c == LEG_LINK[0])
            {
                result = new V1FullyFormattedTextParser();
            }
            else if (c == V2_LINK[0])
            {
                result = new V2FormattedStringParser();
            }
            if (result == null)
            {
                throw new ArgumentException("Unsupported parser link specified (" + c + ") is not in the known set NAFLT");
            }
            result.IdentityProvider = oidp;
            return(result);
        }
コード例 #3
0
 public EventFilterFactory(IOriginIdentityProvider iop)
 {
     this.IncludedProcesses = new List <int>();
     processOriginSource    = iop;
 }
コード例 #4
0
        /// <summary>
        /// Creates a raw entry parser using an initialisation string to create thelinks.  Valid link names are:
        /// N (null) - A (all) - F (Validator) - L (LegacyV1) - T (FormattedV2).  Use RawEntryParserChain.CONSTNAME to get values.
        /// </summary>
        /// <param name="chainInitialisationString">The string to create the chain with</param>
        /// <param name="oidProvider">An identity provider</param>
        /// <returns>A valid raw entry parsing chain</returns>
        internal static RawEntryParserChain CreateChain(string chainInitialisationString, IOriginIdentityProvider oidProvider)
        {
            #region entry code

            if (string.IsNullOrEmpty(chainInitialisationString))
            {
                throw new ArgumentException(chainInitialisationString, "The initialisation string passed to the Parser chain must specify at least one link.");
            }

            //Bilge b = new Bilge();
            //b.Assert.True(chainInitialisationString.IndexOf('F') <= 0, "When a filter is included in the chain it must be included as the first element in the chain.", "Actual " + chainInitialisationString + " \r\n Expected: F" + chainInitialisationString);

            #endregion

            RawEntryParserChain     result = new RawEntryParserChain();
            RawEntryParserChainLink links  = null;
            result.identityProvider = oidProvider;

            links = GetParserLinkByCharacterIdentity(chainInitialisationString[0], oidProvider);
            result.ActiveChain = links;

            for (int i = 1; i < chainInitialisationString.Length; i++)
            {
                links.SetLink(GetParserLinkByCharacterIdentity(chainInitialisationString[i], oidProvider));
                links = links.nextLink;
            }

            return(result);
        }