public static ResourceType find_resource_type(String s) { s = s.trim().toUpperCase(); try { return ResourceType.valueOf(s); } catch (IllegalArgumentException e) { } // try singular if (s.endsWith("S")) { s = s.substring(0, s.length() - 1); } else { return null; } try { return ResourceType.valueOf(s); } catch (IllegalArgumentException e) { } return null; }
public static ResourceType find_resource_type(String s) { s = s.trim().toUpperCase(); try { return ResourceType.valueOf(s); } catch (IllegalArgumentException e) { } // try singular if (s.endsWith("S")) { s = s.substring(0, s.length() - 1); } else { return null; } try { return ResourceType.valueOf(s); } catch (IllegalArgumentException e) { } return null; }
public static ResourceType find_resource_type(String s) { s = s.trim().toUpperCase(); try { return ResourceType.valueOf(s); } catch (IllegalArgumentException e) { } // try singular if (s.endsWith("S")) { s = s.substring(0, s.length() - 1); } else { return null; } try { return ResourceType.valueOf(s); } catch (IllegalArgumentException e) { } return null; }
/** * {@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); } }
public static ResourceType find_resource_type(String s) { s = s.trim().toUpperCase(); try { return ResourceType.valueOf(s); } catch (IllegalArgumentException e) { } // try singular if (s.endsWith("S")) { s = s.substring(0, s.length() - 1); } else { return null; } try { return ResourceType.valueOf(s); } catch (IllegalArgumentException e) { } return null; }
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); } } /**