public new void Execute(FigaroContext context, string args) { args = args.Replace("\"\"", "{blank}"); args = args.Replace("''", "{blank}"); base.Execute(context, args); ValidateArgCount(3, 5); ValidateIndexDescription(argv[0]); if (argv.Length == 5) { context.LookupIndex( argv[0].Replace("{blank}", string.Empty), argv[1].Replace("{blank}", string.Empty), argv[2].Replace("{blank}", string.Empty), argv[3].Replace("{blank}", string.Empty), argv[4].Replace("{blank}", string.Empty) ); } else if (argv.Length == 3) { context.LookupIndex( argv[0].Replace("{blank}", string.Empty), argv[1].Replace("{blank}", string.Empty), argv[2].Replace("{blank}", string.Empty), string.Empty, string.Empty ); } else { throw new ValidationException("Invalid number of arguments."); } }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); var uri = string.Empty; var node = string.Empty; if (Uri.IsWellFormedUriString(argv[0], UriKind.Absolute)) { uri = argv[0]; } else { if (!IndexingStrategy.IsValidIndexingStrategy(argv[0])) { node = argv[0]; } } var idx = from a in argv where IndexingStrategy.IsValidIndexingStrategy(a) select a; foreach (var index in idx) { context.AddIndex(uri, node, index); } }
public new void Execute(FigaroContext context, string args) { try { base.Execute(context, args); bool validate = false; ValidateArgCount(1, 2); //ValidatePath(argv[0]); if (argv.Length > 1) { ValidateLiteral(argv[1], new[] { "validate", "novalidate" }); validate = argv[1].Equals("validate"); } context.OpenContainer(argv[0], validate); } catch (ValidationException) { return; } if (string.IsNullOrEmpty(args)) { WarnUsage(); return; } if (argv.Length == 0) { WarnUsage(); return; } return; }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); ValidateArgCount(1, 1); context.UpgradeContainer(argv[0]); return; }
public new void Execute(FigaroContext context, string args) { try { base.Execute(context, args); if (argv.Length > 1) { if (argv[1].Equals("f")) { context.QueryFile(argv[0]); } else { Error("Invalid option '{0}'. Specify 'f' if you wish to query using an XQuery file."); return; } return; } context.Query(argv[0]); } catch (IndexOutOfRangeException) { Error(DbxmlResources.QueryError); } catch (NullReferenceException) { Error(DbxmlResources.QueryError); } }
public new void Execute(FigaroContext context, string args) { try { if (args.ToLower().Equals("on")) { context.SetDocumentProjection(true); } else if (args.ToLower().Equals("off")) { context.SetDocumentProjection(false); } else { throw new ValidationException("command only accepts 'on' or 'off' as a parameter."); } return; } catch (ValidationException ve) { Warn(ve.Message); WarnUsage(); return; } }
public new void Execute(FigaroContext context, string args) { args = args.Replace("\"\"", "{blank}"); args = args.Replace("''", "{blank}"); base.Execute(context, args); ValidateArgCount(3, 6); if (argv.Length == 3) { context.LookupStatistics(argv[0].Replace("{blank}", string.Empty), argv[1].Replace("{blank}", string.Empty), argv[2].Replace("{blank}", string.Empty), string.Empty, string.Empty, string.Empty); } if (argv.Length == 6) { context.LookupStatistics(argv[0].Replace("{blank}", string.Empty), argv[1].Replace("{blank}", string.Empty), argv[2].Replace("{blank}", string.Empty), argv[3].Replace("{blank}", string.Empty), argv[4].Replace("{blank}", string.Empty), argv[5].Replace("{blank}", string.Empty)); } else { throw new ValidationException(); } }
public new void Execute(FigaroContext context, string args) { try { if (string.IsNullOrEmpty(args)) { context.CreateContainer(string.Empty, "in", false); return; } base.Execute(context, args); ValidateArgCount(1, 3); //ValidatePath(argv[0]); bool validate = false; string ctyp = string.Empty; string w = string.Empty; if (argv.Length > 1) { ValidateLiteral(argv[1].ToLower(), new[] { "n", "in", "d", "id" }); ctyp = argv[1].ToLower(); switch (ctyp) { case "n": w = "with node storage enabled."; break; case "in": w = "with indexed node storage enabled."; break; case "d": w = "with Wholedoc storage enabled."; break; case "id": w = "with indexed Wholedoc storage enabled."; break; } } else { w = "with default container settings enabled."; } if (argv.Length > 2) { ValidateLiteral(argv[2], new[] { "validate", "novalidate" }); validate = argv[2].Equals("validate"); } context.CreateContainer(argv[0], ctyp, validate); Msg("created container {0} {1}", argv[0], w); } catch (ValidationException) { return; } }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); ValidateArgCount(1, 1); if (argv.Length == 1) { context.RemoveAlias(argv[0]); } }
private bool ConfigureCommandLine(string[] args) { var ret = Parser.ParseArguments(args, Options); if (ret) { context = new FigaroContext(Options); } return(ret); }
public void Execute(FigaroContext context) { ctx = context; if (FigaroProductInfo.ProductEdition != FigaroProductEdition.TransactionalDataStore && FigaroProductInfo.ProductEdition != FigaroProductEdition.HighAvailability) { Warn(DbxmlResources.MustUseTDS); throw new ValidationException(); } context.Abort(); }
public new void Execute(FigaroContext context, string args) { if (FigaroProductInfo.ProductEdition != FigaroProductEdition.TransactionalDataStore && FigaroProductInfo.ProductEdition != FigaroProductEdition.HighAvailability) { Warn(DbxmlResources.MustUseTDS); throw new ValidationException(); } context.BeginTransaction(); }
public void Execute(FigaroContext context, string args) { ctx = context; argv = CommandLineToArgs(args); if (argv == null || string.IsNullOrEmpty(args)) { Warn("Missing parameters."); WarnUsage(); throw new ValidationException(); } }
private bool ConfigureCommandLine(string[] args) { var parser = new Parser(parserConfig => parserConfig.HelpWriter = Console.Error); var ret = parser.ParseArgumentsStrict(args, Options, () => Environment.Exit(-2)); if (ret) { context = new FigaroContext(Options); } return(ret); }
public new void Execute(FigaroContext context, string args) { if (string.IsNullOrEmpty(args.Trim())) { ctx = context; context.PrintResults(0, string.Empty); return; } base.Execute(context, args); if (argv.Length == 0) { context.PrintResults(0, string.Empty); return; } if (argv[0].ToLower().Equals("printnames")) { if (argv.Length == 3) { context.PrintNames(int.Parse(argv[1]), argv[2]); return; } if (argv.Length == 2) { int i; if (int.TryParse(argv[1], out i)) { context.PrintNames(i, string.Empty); return; } context.PrintNames(0, argv[2]); return; } context.PrintNames(0, string.Empty); return; } if (argv.Length == 2) { context.PrintResults(int.Parse(argv[0]), argv[1]); return; } int j; if (int.TryParse(argv[0], out j)) { context.PrintResults(j, string.Empty); return; } context.PrintResults(0, argv[0]); }
public new void Execute(FigaroContext context, string args) { if (string.IsNullOrEmpty(args)) { context.Info(false); return; } base.Execute(context, args); context.Info(true); return; }
public new void Execute(FigaroContext context, string args) { if (string.IsNullOrEmpty(args)) { WarnUsage(); throw new ValidationException("no script specified."); } base.Execute(context, args); argv[0] = Path.GetFullPath(argv[0]); Msg("running script '{0}'...", argv[0]); Script = argv[0]; }
public new void Execute(FigaroContext context, string args) { if (string.IsNullOrEmpty(args)) { Warn("Closing all open containers."); context.Close(string.Empty); return; } base.Execute(context, args); context.Close(argv[0]); }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); ValidatePath(argv[0]); var pattern = string.Empty; if (argv.Length > 1) { pattern = argv[1]; } context.PutDocuments(argv[0], pattern); }
public new void Execute(FigaroContext context, string args) { if (string.IsNullOrEmpty(args)) { ctx = context; context.GetDocuments(string.Empty); return; } base.Execute(context, args); context.GetDocuments(argv[0]); return; }
public new void Execute(FigaroContext context, string args) { try { base.Execute(context, args); ValidateArgCount(4, 4); context.SetMetadata(argv[0], argv[1], argv[2], argv[3]); } catch (ValidationException ve) { Warn(ve.Message); WarnUsage(); return; } }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); if (argv.Length == 2) { context.AddAlias(argv[1], argv[0]); return; } if (argv.Length != 1) { return; } context.AddAlias(argv[0]); return; }
public new void Execute(FigaroContext context, string args) { if (string.IsNullOrEmpty(args)) { context.QueryPlan(string.Empty, string.Empty); return; } args = args.Replace("\"\"", "{blank}"); args = args.Replace("''", "{blank}"); base.Execute(context, args); context.QueryPlan( argv[0].Replace("{blank}", string.Empty), argv.Length > 1 ? argv[1] : string.Empty ); }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); if (argv.Length == 3) { switch (argv[2]) { case "f": context.PutDocumentByFile(argv[0]); return; case "s": context.PutDocumentByString(argv[0], argv[1].Replace("{", string.Empty).Replace("}", string.Empty)); return; case "q": context.PutDocumentByQuery(argv[0], argv[1]); return; } } else if (argv.Length == 2) { var res = from opt in new[] { "f", "s", "q" } where argv[1].Equals(opt) select opt; if (res.Count() > 0) { PutDoc(res.First()); } else { context.PutDocumentByString(argv[0], argv[1]); } } else if (argv.Length == 1) { ctx.PutDocumentByString(argv[0], string.Empty); } else { WarnUsage(); throw new ValidationException(); } }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); ValidateLiteral(argv[0], new[] { "true", "false", "on", "off" }); if (argv[0].ToLower().Equals("true") || argv[0].ToLower().Equals("on")) { Ignore = true; return; } if (argv[0].ToLower().Equals("false") || argv[0].ToLower().Equals("off")) { Ignore = false; return; } return; }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); ValidateArgCount(2, 2); context.ReindexContainer(argv[0], argv[1]); }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); ValidateArgCount(2, 2); context.SetNamespace(argv[0], argv[1]); }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); context.RemoveContainer(argv[0]); }
public new void Execute(FigaroContext context, string args) { context.SetBaseUri(args); }
public new void Execute(FigaroContext context, string args) { base.Execute(context, args); context.RemoveDocument(argv[0]); return; }