Пример #1
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);
        }
Пример #2
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");
        }
Пример #3
0
        protected internal override void ProcessOptions(List <string> args)
        {
            CommandFormat cf = new CommandFormat(1, int.MaxValue, "p");

            cf.Parse(args);
            createParents = cf.GetOpt("p");
        }
Пример #4
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(2, int.MaxValue);

                cf.Parse(args);
                GetRemoteDestination(args);
            }
Пример #5
0
        protected internal override void ProcessOptions(List <string> args)
        {
            CommandFormat cf = new CommandFormat(1, 1, "e", "d", "f", "s", "z");

            cf.Parse(args);
            string[] opts = Collections.ToArray(cf.GetOpts(), new string[0]);
            switch (opts.Length)
            {
            case 0:
            {
                throw new ArgumentException("No test flag given");
            }

            case 1:
            {
                flag = opts[0][0];
                break;
            }

            default:
            {
                throw new ArgumentException("Only one test flag is allowed");
            }
            }
        }
Пример #6
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");
            }
Пример #7
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");
            }
Пример #8
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(0, int.MaxValue, "h");

                cf.Parse(args);
                humanReadable = cf.GetOpt("h");
                if (args.IsEmpty())
                {
                    args.AddItem(Path.Separator);
                }
            }
Пример #9
0
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                PopPreserveOption(args);
                CommandFormat cf = new CommandFormat(2, int.MaxValue, "f");

                cf.Parse(args);
                SetOverwrite(cf.GetOpt("f"));
                // should have a -r option
                SetRecursive(true);
                GetRemoteDestination(args);
            }
Пример #10
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);
            }
Пример #11
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);
            }
        }
Пример #12
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);
        }
Пример #13
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);
                        }
                    }
                }
            }
Пример #14
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");
                }
            }
Пример #15
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);
     }
 }
Пример #16
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");
            }
        }
Пример #17
0
            // TODO: should probably allow path arguments for the filesystems
            /// <exception cref="System.IO.IOException"/>
            protected internal override void ProcessOptions(List <string> args)
            {
                CommandFormat cf = new CommandFormat(0, 0);

                cf.Parse(args);
            }