@Override public Object execute() throws Exception { log.info("Disconnecting from current session..."); session.close(); return null; }
@Override public Object execute() throws Exception { log.info("Disconnecting from current session..."); session.close(); return null; }
public void stop() throws Exception { closing = true; if (registration != null) { registration.unregister(); } // The bundle is stopped // so close the console and remove the callback so that the // osgi framework isn't stopped if (session != null) { session.close(); } if (watcher != null) { watcher.stopDelayed(); } }
public void stop() throws Exception { closing = true; if (registration != null) { registration.unregister(); } // The bundle is stopped // so close the console and remove the callback so that the // osgi framework isn't stopped if (session != null) { session.close(); } if (watcher != null) { watcher.stopDelayed(); } }
public String getHelp(Session session, String path) { if (path.indexOf('|') > 0) { if (path.startsWith("command|")) { path = path.substring("command|".length()); } else { return null; } } ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos, true); Session s = session.getFactory().create(bais, ps, ps, session); s.put(Session.SCOPE, session.get(Session.SCOPE)); s.put(Session.SUBSHELL, session.get(Session.SUBSHELL)); try { s.execute(path + " --help"); } catch (Throwable t) { return null; } finally { s.close(); } return baos.toString(); }
public String getHelp(Session session, String path) { if (path.indexOf('|') > 0) { if (path.startsWith("command|")) { path = path.substring("command|".length()); } else { return null; } } ByteArrayInputStream bais = new ByteArrayInputStream(new byte[0]); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos, true); Session s = session.getFactory().create(bais, ps, ps, session); s.put(Session.SCOPE, session.get(Session.SCOPE)); s.put(Session.SUBSHELL, session.get(Session.SUBSHELL)); try { s.execute(path + " --help"); } catch (Throwable t) { return null; } finally { s.close(); } return baos.toString(); }