@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); try { ss.loadReloadableAuxJars(); } catch (IOException e) { LOG.error("fail to reload auxiliary jar files", e); return CommandProcessorResponse.create(e); } return new CommandProcessorResponse(0); }
@Override public CommandProcessorResponse run(String command) throws CommandNeedRetryException { SessionState ss = SessionState.get(); try { ss.loadReloadableAuxJars(); } catch (IOException e) { LOG.error("fail to reload auxiliary jar files", e); return CommandProcessorResponse.create(e); } return new CommandProcessorResponse(0); } }
/** * Authorize command of given type, arguments and for service hosts (for Service Type authorization) * * @param ss - session state * @param type - operation type * @param command - command args * @param serviceObject - service object * @return null if there was no authorization error. Otherwise returns CommandProcessorResponse * capturing the authorization error */ static CommandProcessorResponse authorizeCommandAndServiceObject(SessionState ss, HiveOperationType type, List<String> command, String serviceObject) { if (ss == null) { // ss can be null in unit tests return null; } if (ss.isAuthorizationModeV2() && HiveConf.getBoolVar(ss.getConf(), HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED)) { String errMsg = "Error authorizing command " + command; try { authorizeCommandThrowEx(ss, type, command, serviceObject); // authorized to perform action return null; } catch (HiveAuthzPluginException | HiveAccessControlException e) { LOG.error(errMsg, e); return CommandProcessorResponse.create(e); } } return null; }
Arrays.asList(Arrays.copyOfRange(tokens, 1, tokens.length))); } catch (Exception e) { return CommandProcessorResponse.create(e);
Arrays.asList(Arrays.copyOfRange(tokens, 1, tokens.length))); } catch (Exception e) { return CommandProcessorResponse.create(e);
@Override public CommandProcessorResponse run(String command) throws CommandNeedRetryException { SessionState ss = SessionState.get(); try { ss.reloadAuxJars(); } catch (IOException e) { LOG.error("fail to reload auxiliary jar files", e); return CommandProcessorResponse.create(e); } return new CommandProcessorResponse(0); } }
@Override public CommandProcessorResponse run(String command) { SessionState ss = SessionState.get(); command = new VariableSubstitution().substitute(ss.getConf(),command); String[] tokens = command.split("\\s+"); SessionState.ResourceType t; if (tokens.length < 2 || (t = SessionState.find_resource_type(tokens[0])) == null) { console.printError("Usage: add [" + StringUtils.join(SessionState.ResourceType.values(), "|") + "] <value> [<value>]*"); return new CommandProcessorResponse(1); } CommandProcessorResponse authErrResp = CommandUtil.authorizeCommand(ss, HiveOperationType.ADD, Arrays.asList(tokens)); if(authErrResp != null){ // there was an authorization issue return authErrResp; } try { ss.add_resources(t, Arrays.asList(Arrays.copyOfRange(tokens, 1, tokens.length))); } catch (Exception e) { return CommandProcessorResponse.create(e); } return new CommandProcessorResponse(0); }