Beispiel #1
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(1, int.MaxValue, "f", "r", "R", "skipTrash");

                cf.Parse(args);
                ignoreFNF  = cf.GetOpt("f");
                deleteDirs = cf.GetOpt("r") || cf.GetOpt("R");
                skipTrash  = cf.GetOpt("skipTrash");
            }
Beispiel #2
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(1, int.MaxValue, "crc", "ignoreCrc", "p");

                cf.Parse(args);
                SetWriteChecksum(cf.GetOpt("crc"));
                SetVerifyChecksum(!cf.GetOpt("ignoreCrc"));
                SetPreserve(cf.GetOpt("p"));
                SetRecursive(true);
                GetLocalDestination(args);
            }
Beispiel #3
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(0, int.MaxValue, "h", "s");

                cf.Parse(args);
                humanReadable = cf.GetOpt("h");
                summary       = cf.GetOpt("s");
                if (args.IsEmpty())
                {
                    args.AddItem(Path.CurDir);
                }
            }
Beispiel #4
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(1, int.MaxValue, "f", "p", "l");

                cf.Parse(args);
                SetOverwrite(cf.GetOpt("f"));
                SetPreserve(cf.GetOpt("p"));
                SetLazyPersist(cf.GetOpt("l"));
                GetRemoteDestination(args);
                // should have a -r option
                SetRecursive(true);
            }
Beispiel #5
0
        protected internal override void ProcessOptions(List <string> args)
        {
            CommandFormat cf = new CommandFormat(1, int.MaxValue, OptionQuota, OptionHuman);

            cf.Parse(args);
            if (args.IsEmpty())
            {
                // default path is the current working directory
                args.AddItem(".");
            }
            showQuotas    = cf.GetOpt(OptionQuota);
            humanReadable = cf.GetOpt(OptionHuman);
        }
Beispiel #6
0
        /// <exception cref="System.IO.IOException"/>
        protected internal override void ProcessOptions(List <string> args)
        {
            CommandFormat cf = new CommandFormat(0, int.MaxValue, "d", "h", "R");

            cf.Parse(args);
            dirRecurse = !cf.GetOpt("d");
            SetRecursive(cf.GetOpt("R") && dirRecurse);
            humanReadable = cf.GetOpt("h");
            if (args.IsEmpty())
            {
                args.AddItem(Path.CurDir);
            }
        }
Beispiel #7
0
        // milliseconds
        /// <exception cref="System.IO.IOException"/>
        protected internal override void ProcessOptions(List <string> args)
        {
            CommandFormat cf = new CommandFormat(1, 1, "f");

            cf.Parse(args);
            follow = cf.GetOpt("f");
        }
Beispiel #8
0
        protected internal override void ProcessOptions(List <string> args)
        {
            CommandFormat cf = new CommandFormat(1, int.MaxValue, "p");

            cf.Parse(args);
            createParents = cf.GetOpt("p");
        }
Beispiel #9
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(1, int.MaxValue, "-ignore-fail-on-non-empty"
                                                     );

                cf.Parse(args);
                ignoreNonEmpty = cf.GetOpt("-ignore-fail-on-non-empty");
            }
Beispiel #10
0
        // default format string
        /// <exception cref="System.IO.IOException"/>
        protected internal override void ProcessOptions(List <string> args)
        {
            CommandFormat cf = new CommandFormat(1, int.MaxValue, "R");

            cf.Parse(args);
            SetRecursive(cf.GetOpt("R"));
            if (args.GetFirst().Contains("%"))
            {
                format = args.RemoveFirst();
            }
            cf.Parse(args);
        }
Beispiel #11
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(0, int.MaxValue, "R");

                cf.Parse(args);
                SetRecursive(cf.GetOpt("R"));
                if (args.IsEmpty())
                {
                    throw new HadoopIllegalArgumentException("<path> is missing");
                }
                if (args.Count > 1)
                {
                    throw new HadoopIllegalArgumentException("Too many arguments");
                }
            }
Beispiel #12
0
 /// <exception cref="System.IO.IOException"/>
 protected internal override void ProcessOptions(List <string> args)
 {
     try
     {
         CommandFormat cf = new CommandFormat(2, int.MaxValue, "nl");
         cf.Parse(args);
         delimiter = cf.GetOpt("nl") ? "\n" : null;
         dst       = new PathData(new URI(args.RemoveLast()), GetConf());
         if (dst.exists && dst.stat.IsDirectory())
         {
             throw new PathIsDirectoryException(dst.ToString());
         }
         srcs = new List <PathData>();
     }
     catch (URISyntaxException e)
     {
         throw new IOException("unexpected URISyntaxException", e);
     }
 }
Beispiel #13
0
        /// <exception cref="System.IO.IOException"/>
        protected internal override void ProcessOptions(List <string> args)
        {
            CommandFormat cf = new CommandFormat(2, int.MaxValue, "R", "w");

            cf.Parse(args);
            waitOpt = cf.GetOpt("w");
            SetRecursive(true);
            try
            {
                newRep = short.ParseShort(args.RemoveFirst());
            }
            catch (FormatException nfe)
            {
                DisplayWarning("Illegal replication, a positive integer expected");
                throw;
            }
            if (newRep < 1)
            {
                throw new ArgumentException("replication must be >= 1");
            }
        }
Beispiel #14
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                cf.Parse(args);
                SetRecursive(cf.GetOpt("R"));
                // Mix of remove and modify acl flags are not allowed
                bool bothRemoveOptions = cf.GetOpt("b") && cf.GetOpt("k");
                bool bothModifyOptions = cf.GetOpt("m") && cf.GetOpt("x");
                bool oneRemoveOption   = cf.GetOpt("b") || cf.GetOpt("k");
                bool oneModifyOption   = cf.GetOpt("m") || cf.GetOpt("x");
                bool setOption         = cf.GetOpt("-set");

                if ((bothRemoveOptions || bothModifyOptions) || (oneRemoveOption && oneModifyOption
                                                                 ) || (setOption && (oneRemoveOption || oneModifyOption)))
                {
                    throw new HadoopIllegalArgumentException("Specified flags contains both remove and modify flags"
                                                             );
                }
                // Only -m, -x and --set expects <acl_spec>
                if (oneModifyOption || setOption)
                {
                    if (args.Count < 2)
                    {
                        throw new HadoopIllegalArgumentException("<acl_spec> is missing");
                    }
                    aclEntries = AclEntry.ParseAclSpec(args.RemoveFirst(), !cf.GetOpt("x"));
                }
                if (args.IsEmpty())
                {
                    throw new HadoopIllegalArgumentException("<path> is missing");
                }
                if (args.Count > 1)
                {
                    throw new HadoopIllegalArgumentException("Too many arguments");
                }
                // In recursive mode, save a separate list of just the access ACL entries.
                // Only directories may have a default ACL.  When a recursive operation
                // encounters a file under the specified path, it must pass only the
                // access ACL entries.
                if (IsRecursive() && (oneModifyOption || setOption))
                {
                    accessAclEntries = Lists.NewArrayList();
                    foreach (AclEntry entry in aclEntries)
                    {
                        if (entry.GetScope() == AclEntryScope.Access)
                        {
                            accessAclEntries.AddItem(entry);
                        }
                    }
                }
            }