/** * {@inheritDoc} */ @Override public void setSessionParameter(LensSessionHandle sessionid, String key, String value) { HashMap<String, String> config = Maps.newHashMap(); config.put(key, value); setSessionParameters(sessionid, config); try { LENS_SERVER_DAO.updateActiveSession(getSession(sessionid).getLensSessionPersistInfo()); } catch (LensException e) { log.warn("Failed to update active session table with error," + e.toString()); } }
/** * {@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); } }
/** * {@inheritDoc} */ @Override public void deleteResource(LensSessionHandle sessionid, String type, String path) { String command = "delete " + type.toLowerCase() + " " + path; try { acquire(sessionid); closeCliServiceOp(getCliService().executeStatement(getHiveSessionHandle(sessionid), command, null)); getSession(sessionid).removeResource(type, path); try { LENS_SERVER_DAO.updateActiveSession(getSession(sessionid).getLensSessionPersistInfo()); } catch (LensException e) { log.warn("Failed to update active session table with error," + e.toString()); } } catch (HiveSQLException e) { throw new WebApplicationException(e); } finally { release(sessionid); } }