public Iostat(Shell shell) { super(shell); setOutputFormat(OUTPUT_FORMAT); this.completer = new FileCompleter(shell); }
public void processCommand(String[] args) throws ShellCommandUsageException, ShellCommandExecException { if (!validateArgs(args)) { throw new ShellCommandUsageException(getSyntax()); } try { output(args); } catch (SigarException e) { throw new ShellCommandExecException(e.getMessage()); } }
public SigarCommandBase(Shell shell) { this.shell = shell; this.out = shell.getOutStream(); this.err = shell.getErrStream(); this.sigar = shell.getSigar(); this.proxy = shell.getSigarProxy(); //provide simple way for handlers to implement tab completion this.completer = new CollectionCompleter(shell); if (isPidCompleter()) { this.ptqlCompleter = new ProcessQueryCompleter(shell); } }
public String complete(String line) { if (isPidCompleter()) { return completePid(line); } GetlineCompleter c = getCompleter(); if (c != null) { return c.complete(line); } this.completer.setCollection(getCompletions()); return this.completer.complete(line); } }
continue; String name = FileCompleter.expand(arg); FileSystem fs = mounts.getMountPoint(name);
public void shutdown() { this.sigar.close(); //cleanup for dmalloc //using reflection incase junit.jar is not present try { //SigarTestCase.closeSigar(); Class.forName("org.hyperic.sigar.test.SigarTestCase"). getMethod("closeSigar", new Class[0]).invoke(null, new Object[0]); } catch (ClassNotFoundException e) { //SigarTestCase.java not compiled w/o junit.jar } catch (Exception e) { e.printStackTrace(); } catch (NoClassDefFoundError e) { //avoiding possible Class Not Found: junit/framework/TestCase } super.shutdown(); }
public void processCommand(ShellCommandHandler handler, String args[]) throws ShellCommandUsageException, ShellCommandExecException { try { super.processCommand(handler, args); if (handler instanceof SigarCommandBase) { ((SigarCommandBase)handler).flush(); } } finally { SigarProxyCache.clear(this.proxy); } }
public Df(Shell shell) { super(shell); setOutputFormat(OUTPUT_FORMAT); this.completer = new FileCompleter(shell); }
public void outputFileSystem(String arg) throws SigarException { FileSystemMap mounts = this.proxy.getFileSystemMap(); String name = FileCompleter.expand(arg); FileSystem fs = mounts.getMountPoint(name); if (fs != null) { printHeader(); output(fs); return; } throw new SigarException(arg + " No such file or directory"); }