static String getString(CommandLine commandLine, Option option) { Object val = commandLine.getValue(option); if (val != null) { return val.toString(); } return null; }
@SuppressWarnings("unchecked") protected void doExecute(VaultFsApp app, CommandLine cl) throws Exception { List<String> localPaths = cl.getValues(argLocalPath); List<File> localFiles = app.getPlatformFiles(localPaths, false); File localDir = app.getPlatformFile("", true); VltContext vCtx = app.createVaultContext(localDir); vCtx.setQuiet(cl.hasOption(OPT_QUIET)); PropGet a = new PropGet(localDir, localFiles, !cl.hasOption(optRecursive), (String) cl.getValue(argPropName)); vCtx.execute(a); }
public Object getOptionValue(String optName) { if (cmdLine == null) throw new IllegalStateException(); return this.cmdLine.getValue(optName); }
public Object getOptionValue(Option opt) { if (cmdLine == null) throw new IllegalStateException(); return this.cmdLine.getValue(opt); }
static Double getDouble(CommandLine commandLine, Option option) { Object val = commandLine.getValue(option); if (val != null) { return Double.parseDouble(val.toString()); } return null; }
protected void doExecute(ExecutionContext ctx, CommandLine cl) throws Exception { String name = (String) cl.getValue(argName); if (name == null) { System.out.println("Hello, world."); } else { System.out.println("Hello, " + name + "."); } }
private static <InterfaceType> Class<? extends InterfaceType> getClass(CommandLine cl, String key, JobConf conf, Class<InterfaceType> cls ) throws ClassNotFoundException { return conf.getClassByName((String) cl.getValue(key)).asSubclass(cls); }
protected void doExecute(ConsoleExecutionContext ctx, CommandLine cl) throws Exception { String path = (String) cl.getValue(argPath, "/"); ctx.cd(path); }
protected void doExecute(ExecutionContext ctx, CommandLine cl) throws Exception { String cmd = (String) cl.getValue(argCommand); ctx.printHelp(cmd); }
protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception { String path = (String) cl.getValue(argPath); int depth = Integer.MAX_VALUE; if (cl.hasOption(optRecursive)) { depth = ((Long) cl.getValue(optRecursive)).intValue(); } ConsoleFile file = ctx.getFile(path, true); tree(file, depth, ""); }
protected void doExecute(ConsoleExecutionContext ctx, CommandLine cl) throws Exception { String file = (String) cl.getValue(argFile); ctx.getApplication().saveConfig(file); }
protected void doExecute(ConsoleExecutionContext ctx, CommandLine cl) throws Exception { String file = (String) cl.getValue(argFile); ctx.getApplication().loadConfig(file); }
protected void doExecute(ConsoleExecutionContext ctx, CommandLine cl) throws Exception { String arg = (String) cl.getValue(argContext); ctx.getConsole().switchContext(arg); }
protected void doExecute(ConsoleExecutionContext ctx, CommandLine cl) throws Exception { String macro = (String) cl.getValue(argMacro); String cmd = ctx.getProperty("macro." + macro); if (cmd == null) { throw new ExecutionException("Macro " + macro + " does not exist."); } ctx.execute(cmd); }
protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception { int fmtFlag = getFormatFlags(ctx, cl); String path = (String) cl.getValue(argPath); ConsoleFile file = ctx.getFile(path, true); ls(file, fmtFlag, 0); }
protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception { String jcrPath = (String) cl.getValue(argJcrPath); ConsoleFile wo = ctx.getFile(jcrPath, true); if (wo instanceof VaultFsCFile) { VaultFile file = (VaultFile) wo.unwrap(); file.invalidate(); } else { throw new ExecutionException("'cat' only possible in jcr fs context"); } }
protected void doExecute(ExecutionContext ctx, CommandLine cl) throws Exception { String file = (String) cl.getValue(argFile); ctx.getApplication().loadConfig(file); ctx.getApplication().getConsole().run(); }
protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception { String path = (String) cl.getValue(argPath); boolean recursive = cl.hasOption(optRecursive); ConsoleFile file = ctx.getFile(path, true); if (file instanceof AggregateCFile) { AggregateImpl node = (AggregateImpl) file.unwrap(); node.remove(recursive); } else { throw new ExecutionException("remove only allowed in afct mode."); } }
protected void doExecute(VaultFsConsoleExecutionContext ctx, CommandLine cl) throws Exception { String uri = (String) cl.getValue(argURI); if (uri != null) { ctx.getVaultFsApp().setProperty(VaultFsApp.KEY_DEFAULT_URI, uri); } if (ctx.getVaultFsApp().isConnected() && cl.hasOption(optForce)) { ctx.getVaultFsApp().disconnect(); } ctx.getVaultFsApp().connect(); }