public String getSessionResourcePath() throws Exception { return RegistryUtil.getSessionResourcePath(); }
/** * Returns the resource path, which should be used to generate UIs. This will be set by the * metadata UI, when it is loading. So all other UIs in the resources page should load after * that. * * @param request this is used to get the current path set by the metadata UI. * @return current resource path */ public static String getPath(HttpServletRequest request) { String path = request.getParameter("path"); if (path == null || "".equals(path)) { path = (String) request.getAttribute("path"); } if (path != null) { path = sanitizeHTML(path); } return path; }
public void setSessionResourcePath(String resourcePath) throws Exception { RegistryUtil.setSessionResourcePath(resourcePath); }
public ContentBean getContent(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); ContentBean bean = null; try { bean = stub.getContentBean(path); } catch (Exception e) { String msg = "Failed to get content from the resource service. " + e.getMessage(); log.error(msg, e); throw e; } return bean; }
public Subscription getSubscription(String id) { try { if (id != null && id.contains(";version:")) { log.warn( "Versioned resources cannot have subscriptions, instead returns the subscription from the actual resource"); return EventingDataHolder.getInstance().getRegistryEventBrokerService() .getSubscription(RegistryUtil.getResourcePathFromVersionPath(id)); } else { return EventingDataHolder.getInstance().getRegistryEventBrokerService().getSubscription(id); } } catch (EventBrokerException e) { log.error("Unable to get subscription for given id: " + id, e); return null; } }
public PermissionBean getPermissions(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); PermissionBean bean; try { bean = stub.getPermissions(path); } catch (Exception e) { String msg = "Failed to get permissions of the resource " + path + ". " + e.getMessage(); log.error(msg, e); throw e; } return bean; }
public MetadataBean getMetadata(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); if (path == null) { path = getSessionResourcePath(); if (path == null) { path = RegistryConstants.ROOT_PATH; } request.setAttribute("path", path); } MetadataBean bean = null; try { bean = stub.getMetadata(path); } catch (Exception e) { String msg = "Failed to get resource metadata from the resource service. " + e.getMessage(); log.error(msg, e); throw e; } return bean; }
public MetadataBean getMetadata(String path) throws Exception { RegistryUtil.setSessionResourcePath(path); UserRegistry registry = (UserRegistry)getRootRegistry(); return MetadataPopulator.populate(path, registry); }
public String getTextContent(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); if (path != null && path.contains("..")) { path = FilenameUtils.normalize(path); } String textContent = null; try { textContent = stub.getTextContent(path); MetadataBean metadataBean = stub.getMetadata(path); String resourceVersion = metadataBean.getResourceVersion(); request.getSession().setAttribute("resourceVersion",resourceVersion); } catch (Exception e) { String msg = "Failed get text content of the resource " + path + ". " + e.getMessage(); log.error(msg, e); throw e; } return textContent; }
public CollectionContentBean getCollectionContent(HttpServletRequest request) throws Exception { String path = RegistryUtil.getPath(request); CollectionContentBean bean = null; try { if(PaginationContext.getInstance() ==null){ bean = stub.getCollectionContent(path); }else { PaginationUtils.copyPaginationContext(stub._getServiceClient()); bean = stub.getCollectionContent(path); int rowCount = PaginationUtils.getRowCount(stub._getServiceClient()); session.setAttribute("row_count", Integer.toString(rowCount)); } } catch (Exception e) { String msg = "Failed to get collection content from the resource service. " + e.getMessage(); log.error(msg, e); throw e; } finally { PaginationContext.destroy(); } return bean; }