Exemplo n.º 1
0
  /**
   * Try to find determine the modules.
   *
   * @param parent the parent content item
   * @param root the current root
   * @param context the module context
   */
  void processModules(
      final DistributionContentItem parent, final File root, final ModuleContext context) {

    final DistributionContentItem item = new DistributionItemFileImpl(root, parent);
    final File moduleXml = new File(root, "module.xml");
    if (moduleXml.exists()) {
      // Only ignore actual modules
      if (context.isIgnored(item)) {
        return;
      }
      context.addModule(item);
    }
    final File[] children = root.listFiles();
    if (children != null && children.length != 0) {
      for (final File child : children) {
        processModules(item, child, context);
      }
    }
  }
Exemplo n.º 2
0
  /**
   * Try to determine the bundles.
   *
   * @param parent the parent content item
   * @param root the current root
   * @param context the bundle context
   */
  void processBundles(
      final DistributionContentItem parent, final File root, final ModuleContext context) {

    final DistributionContentItem item = new DistributionItemFileImpl(root, parent);
    final File[] children = root.listFiles();
    if (children != null && children.length != 0) {
      for (final File child : children) {
        if (!child.isDirectory()) {
          // Only ignore actual bundles
          if (context.isIgnored(item)) {
            return;
          }
          context.addModule(item);
          return;
        }
      }
      for (final File child : children) {
        processBundles(item, child, context);
      }
    }
  }
  public int doStartTag() throws JspException {
    try {
      HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
      ModuleContext context = (ModuleContext) request.getSession().getAttribute("context");

      String viewObject = request.getParameter("viewObject");
      viewObject = (viewObject == null || viewObject.equals("")) ? "xava_view" : viewObject;
      View view = (View) context.get(request, viewObject);

      MetaReference metaReference = view.getMetaReference(reference).cloneMetaReference();
      metaReference.setName(reference);
      String prefix = request.getParameter("propertyPrefix");
      prefix = prefix == null ? "" : prefix;
      String application = request.getParameter("application");
      String module = request.getParameter("module");
      String referenceKey = Ids.decorate(application, module, prefix + reference);
      request.setAttribute(referenceKey, metaReference);
      String editorURL =
          "reference.jsp?referenceKey="
              + referenceKey
              + "&onlyEditor=true&frame=false&composite=false&descriptionsList=true";
      String editorPrefix = Module.isPortlet() ? "/WEB-INF/jsp/xava/" : "/xava/";
      try {
        pageContext.include(editorPrefix + editorURL);
      } catch (ServletException ex) {
        Throwable cause = ex.getRootCause() == null ? ex : ex.getRootCause();
        log.error(cause.getMessage(), cause);
        pageContext.include(editorPrefix + "editors/notAvailableEditor.jsp");
      } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        pageContext.include(editorPrefix + "editors/notAvailableEditor.jsp");
      }
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);
      throw new JspException(XavaResources.getString("descriptionsList_tag_error", reference));
    }
    return SKIP_BODY;
  }