Exemplo n.º 1
0
            /// <exception cref="System.IO.IOException"/>
            public virtual int Run(Configuration conf, IList <string> args)
            {
                if (!args.IsEmpty())
                {
                    System.Console.Error.WriteLine("Can't understand argument: " + args[0]);
                    return(1);
                }
                DistributedFileSystem dfs = AdminHelper.GetDFS(conf);

                try
                {
                    TableListing listing = new TableListing.Builder().AddField(string.Empty).AddField
                                               (string.Empty, true).WrapWidth(AdminHelper.MaxLineWidth).HideHeaders().Build();
                    RemoteIterator <EncryptionZone> it = dfs.ListEncryptionZones();
                    while (it.HasNext())
                    {
                        EncryptionZone ez = it.Next();
                        listing.AddRow(ez.GetPath(), ez.GetKeyName());
                    }
                    System.Console.Out.WriteLine(listing.ToString());
                }
                catch (IOException e)
                {
                    System.Console.Error.WriteLine(PrettifyException(e));
                    return(2);
                }
                return(0);
            }
Exemplo n.º 2
0
        /// <exception cref="System.IO.IOException"/>
        private int ListSpanReceivers(IList <string> args)
        {
            SpanReceiverInfo[] infos = remote.ListSpanReceivers();
            if (infos.Length == 0)
            {
                System.Console.Out.WriteLine("[no span receivers found]");
                return(0);
            }
            TableListing listing = new TableListing.Builder().AddField("ID").AddField("CLASS"
                                                                                      ).ShowHeaders().Build();

            foreach (SpanReceiverInfo info in infos)
            {
                listing.AddRow(string.Empty + info.GetId(), info.GetClassName());
            }
            System.Console.Out.WriteLine(listing.ToString());
            return(0);
        }