@Override protected PortofinoRoot getRoot(FileObject actionsDirectory, ResourceResolvers resourceResolver) throws Exception { return PortofinoRoot.get(actionsDirectory, resourceResolver); }
public static boolean unmount(FileObject object) { return children.remove(getDefaultMountPointName(object), object); }
protected PortofinoRoot(FileObject location, ResourceResolver resourceResolver) { setLocation(location); this.resourceResolver = resourceResolver; }
/** * Returns a description of the root. * @since 5.0 * @return the page's description as JSON. */ @Path(":description") @Produces(MediaType.APPLICATION_JSON) @GET @RequiresPermissions(level = AccessLevel.NONE) public Map<String, Object> getJSONDescription() { Map<String, Object> description = new HashMap<String, Object>(); description.put("superclass", getClass().getSuperclass().getName()); description.put("class", getClass().getName()); description.put("page", pageInstance.getPage()); description.put("path", getPath()); description.put("children", getSubResources()); description.put("loginPath", portofinoConfiguration.getString("login.path")); return description; }
@Override public PortofinoRoot init() { super.init(); Page rootPage = PageLogic.getPage(location); PageInstance pageInstance = new PageInstance(null, location, rootPage, getClass()); setPageInstance(pageInstance); HttpServletRequest request = ElementsThreadLocals.getHttpServletRequest(); ActionContext context = new ActionContext(); context.setServletContext(servletContext); context.setRequest(request); context.setResponse(response); context.setActionPath("/"); setContext(context); return this; }
public static PortofinoRoot get(FileObject location, ResourceResolver resourceResolver) throws Exception { Resource root = Root.get(location, resourceResolver); if (!(root instanceof PortofinoRoot)) { if(!root.getClass().equals(Root.class)) { logger.warn(root + " defined in " + location + " does not extend PortofinoRoot, ignoring"); } root = new PortofinoRoot(location, resourceResolver); } return (PortofinoRoot) root; }
@PostConstruct public void init() { FileObject fileObject; try { fileObject = VFS.getManager().resolveFile("res:com/manydesigns/portofino/upstairs/actions"); } catch (FileSystemException e) { throw new RuntimeException(e); } PortofinoRoot.mount(fileObject, "portofino-upstairs"); status = ModuleStatus.STARTED; }
@Override @Path("{pathSegment}") public Object consumePathSegment(@PathParam("pathSegment") String pathSegment) { logger.debug("Publishing securityUtils in OGNL context"); OgnlContext ognlContext = ElementsThreadLocals.getOgnlContext(); ognlContext.put("securityUtils", new SecurityUtilsBean()); logger.debug("Publishing textProvider in OGNL context"); ognlContext.put("textProvider", new TextProviderBean(ElementsThreadLocals.getTextProvider())); FileObject child = children.get(pathSegment); if(child != null) { return consumePathSegment(pathSegment, child, resourceResolver); } return super.consumePathSegment(pathSegment); }
public static void mount(FileObject fileObject) { FileObject previous = children.putIfAbsent(getDefaultMountPointName(fileObject), fileObject); if(previous != null) { throw new RuntimeException("Already mounted: " + previous); } }