Example #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);
            }
Example #2
0
 /// <summary>
 /// Returns a RemoteIterator which can be used to list the encryption zones
 /// in HDFS.
 /// </summary>
 /// <remarks>
 /// Returns a RemoteIterator which can be used to list the encryption zones
 /// in HDFS. For large numbers of encryption zones, the iterator will fetch
 /// the list of zones in a number of small batches.
 /// <p/>
 /// Since the list is fetched in batches, it does not represent a
 /// consistent snapshot of the entire list of encryption zones.
 /// <p/>
 /// This method can only be called by HDFS superusers.
 /// </remarks>
 /// <exception cref="System.IO.IOException"/>
 public virtual RemoteIterator <EncryptionZone> ListEncryptionZones()
 {
     return(dfs.ListEncryptionZones());
 }