public String add_resource(ResourceType t, String value) throws RuntimeException { return add_resource(t, value, false); }
public String add_resource(ResourceType t, String value) throws RuntimeException { return add_resource(t, value, false); }
private String fetchFilesNotInLocalFilesystem(String cmd) { SessionState ss = SessionState.get(); String progName = getScriptProgName(cmd); if (!ResourceDownloader.isFileUri(progName)) { String filePath = ss.add_resource(ResourceType.FILE, progName, true); Path p = new Path(filePath); String fileName = p.getName(); String scriptArgs = getScriptArgs(cmd); String finalCmd = fileName + scriptArgs; return finalCmd; } return cmd; }
private String fetchFilesNotInLocalFilesystem(String cmd) { SessionState ss = SessionState.get(); String progName = getScriptProgName(cmd); if (!ResourceDownloader.isFileUri(progName)) { String filePath = ss.add_resource(ResourceType.FILE, progName, true); Path p = new Path(filePath); String fileName = p.getName(); String scriptArgs = getScriptArgs(cmd); String finalCmd = fileName + scriptArgs; return finalCmd; } return cmd; }
ss.add_resource(ResourceType.JAR, testArchive.getAbsolutePath());
ss.add_resource(ResourceType.JAR, testArchive.getAbsolutePath());
public void add_resource(ResourceType t, String value) { // By default don't convert to unix add_resource(t, value, false); }
public String add_resource(ResourceType t, String value) throws RuntimeException { return add_resource(t, value, false); }
private String fetchFilesNotInLocalFilesystem(String cmd) { SessionState ss = SessionState.get(); String progName = getScriptProgName(cmd); if (progName.matches("("+ SessionState.getMatchingSchemaAsRegex() +")://.*")) { String filePath = ss.add_resource(ResourceType.FILE, progName, true); if (filePath == null) { throw new RuntimeException("Could not download the resource: " + progName); } Path p = new Path(filePath); String fileName = p.getName(); String scriptArgs = getScriptArgs(cmd); String finalCmd = fileName + scriptArgs; return finalCmd; } return cmd; }
private String fetchFilesNotInLocalFilesystem(String cmd) { SessionState ss = SessionState.get(); String progName = getScriptProgName(cmd); if (SessionState.canDownloadResource(progName)) { String filePath = ss.add_resource(ResourceType.FILE, progName, true); Path p = new Path(filePath); String fileName = p.getName(); String scriptArgs = getScriptArgs(cmd); String finalCmd = fileName + scriptArgs; return finalCmd; } return cmd; }
private void addResourceUponRestart(LensSessionHandle sessionid, ResourceEntry resourceEntry) { try { acquire(sessionid); SessionState ss = getSession(sessionid).getSessionState(); resourceEntry.location = ss.add_resource(SessionState.ResourceType.valueOf(resourceEntry.getType()), resourceEntry.getUri()); if (resourceEntry.location == null) { throw new NullPointerException("Resource's final location cannot be null"); } } finally { release(sessionid); } } /**
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); } for (int i = 1; i < tokens.length; i++) { ss.add_resource(t, tokens[i]); } return new CommandProcessorResponse(0); }
ss.add_resource(ResourceType.JAR, testArchive.getAbsolutePath());
/** * {@inheritDoc} */ @Override public void addResource(LensSessionHandle sessionid, String type, String path) { try { resotreSessionIfRequired(sessionid); acquire(sessionid); SessionState ss = getSession(sessionid).getSessionState(); String finalLocation = ss.add_resource(SessionState.ResourceType.valueOf(type.toUpperCase()), path); getSession(sessionid).addResource(type, path, finalLocation); try { LENS_SERVER_DAO.updateActiveSession(getSession(sessionid).getLensSessionPersistInfo()); } catch (LensException e) { log.warn("Failed to update active session table with error," + e.toString()); } } catch (RuntimeException e) { log.error("Failed to add resource type:" + type + " path:" + path + " in session", e); throw new WebApplicationException(e); } finally { release(sessionid); } }