Exemple #1
0
            /// <summary>Parse a list of comma-separated nodes.</summary>
            /// <exception cref="System.IO.IOException"/>
            internal override void Parse(IList <Parser.Token> args, JobConf job)
            {
                ListIterator <Parser.Token> i = args.ListIterator();

                while (i.HasNext())
                {
                    Parser.Token t = i.Next();
                    t.GetNode().SetID(i.PreviousIndex() >> 1);
                    kids.AddItem(t.GetNode());
                    if (i.HasNext() && !Parser.TType.Comma.Equals(i.Next().GetType()))
                    {
                        throw new IOException("Expected ','");
                    }
                }
            }
Exemple #2
0
            /// <summary>
            /// Let the first actual define the InputFormat and the second define
            /// the <tt>mapred.input.dir</tt> property.
            /// </summary>
            /// <exception cref="System.IO.IOException"/>
            internal override void Parse(IList <Parser.Token> ll, JobConf job)
            {
                StringBuilder sb             = new StringBuilder();
                IEnumerator <Parser.Token> i = ll.GetEnumerator();

                while (i.HasNext())
                {
                    Parser.Token t = i.Next();
                    if (Parser.TType.Comma.Equals(t.GetType()))
                    {
                        try
                        {
                            inf = (InputFormat)ReflectionUtils.NewInstance(job.GetClassByName(sb.ToString()),
                                                                           job);
                        }
                        catch (TypeLoadException e)
                        {
                            throw (IOException)Sharpen.Extensions.InitCause(new IOException(), e);
                        }
                        catch (ArgumentException e)
                        {
                            throw (IOException)Sharpen.Extensions.InitCause(new IOException(), e);
                        }
                        break;
                    }
                    sb.Append(t.GetStr());
                }
                if (!i.HasNext())
                {
                    throw new IOException("Parse error");
                }
                Parser.Token t_1 = i.Next();
                if (!Parser.TType.Quot.Equals(t_1.GetType()))
                {
                    throw new IOException("Expected quoted string");
                }
                indir = t_1.GetStr();
            }