@Override public Object execute(final CommandSession commandSession, List<Object> arguments) throws Exception { // TODO: remove the hack for .session Session session = (Session) commandSession.get(".session"); // When need to translate closures to a compatible type for the command for (int i = 0; i < arguments.size(); i++) { Object v = arguments.get(i); if (v instanceof Closure) { final Closure closure = (Closure) v; arguments.set(i, (org.apache.karaf.shell.api.console.Function) (s, a) -> closure.execute(commandSession, a)); } } return command.execute(session, arguments); }
@Override public Object execute(final CommandSession commandSession, List<Object> arguments) throws Exception { // TODO: remove the hack for .session Session session = (Session) commandSession.get(".session"); // When need to translate closures to a compatible type for the command for (int i = 0; i < arguments.size(); i++) { Object v = arguments.get(i); if (v instanceof Closure) { final Closure closure = (Closure) v; arguments.set(i, (org.apache.karaf.shell.api.console.Function) (s, a) -> closure.execute(commandSession, a)); } } return command.execute(session, arguments); }
/** * {@link Action}.{@link #execute()} will be called on the CommandWrapper instance created by Karaf (see * {@link CommandWrapper} default constructor). */ @Override public Object execute() throws Exception { List<Command> commands = registry.getCommands(); for (Command command : commands) { if (command.getScope().equals(SCOPE) && command instanceof CommandWrapper) { command.execute(null, Arrays.asList(new Object[] { "--help" })); } } return null; }
@Override public Object execute(Session session, List<Object> arguments) throws Exception { factory.checkSecurity(getScope(), getName(), arguments); return command.execute(session, arguments); }
@Override public Object execute(Session session, List<Object> arguments) throws Exception { factory.checkSecurity(getScope(), getName(), arguments); return command.execute(session, arguments); }