Package org.meshcms.util

Examples of org.meshcms.util.Path


    return true;
  }
 
  protected boolean preProcessDirectory(File file, Path path) {
    if (!webSite.isSystem(path)) {
      Path wPath = webSite.findCurrentWelcome(path);
     
      if (wPath == null && path.isRoot()) {
        String wName = webSite.getWelcomeFileNames()[0];
       
        try {
          Utils.writeFully(new File(file, wName),
              webSite.getHTMLTemplate("Home Page"));
          webSite.getSiteInfo().setPageTheme(Path.ROOT, "default");
          webSite.getSiteInfo().store();
          wPath = new Path(wName);
        } catch (IOException ex) {
          webSite.log("Can't create home page for empty site", ex);
        }
      }
     
View Full Code Here


  protected void processFile(File file, Path path) {
    if (!FileTypes.isPage(path.getLastElement())) {
      return;
    }
   
    Path dirPath = path.getParent();
    Path welcome = (Path) currentWelcomes.get(dirPath);
   
    if (welcome == null) {
      return;
    }
   
    Path parentPath = dirPath.getParent();
   
    if (!parentPath.isRelative() && currentWelcomes.get(parentPath) == null) {
      return;
    }
   
    path = welcome.equals(path) ? dirPath : path;
    PageInfo pageInfo = null;
View Full Code Here

   
    langList = new ArrayList();
    Iterator iter = getPagesInDirectory(Path.ROOT, false).iterator();
   
    while (iter.hasNext()) {
      Path path = ((PageInfo) iter.next()).getPath();
     
      if (path.getElementCount() == 1) {
        Locale locale = Utils.getLocale(path.getElementAt(0));
       
        if (locale != null) {
          langList.add(new CodeLocalePair(path.getElementAt(0), locale));
        }
      }
    }
   
    langList = Collections.unmodifiableList(langList);
View Full Code Here

  /**
   * Returns the given path unless it is a folder with a welcome file; in this
   * case the welcome file path is returned.
   */
  public Path getServedPath(Path path) {
    Path welcome = (Path) currentWelcomes.get(path);
    return (welcome == null) ? path : welcome;
  }
View Full Code Here

   
    if (map != null) {
      Iterator iter = map.keySet().iterator();
     
      while (iter.hasNext()) {
        Path p = (Path) iter.next();
       
        if (p.getElementCount() == n) {
          return true;
        }
      }
    }
   
View Full Code Here

  public PageInfo[] getBreadcrumbs(Path path) {
    path = getPathInMenu(path);
    List list = new ArrayList();
   
    for (int i = 0; i < path.getElementCount(); i++) {
      Path partial = path.getPartial(i);
      PageInfo pi = getPageInfo(partial);
     
      if (pi != null) {
        list.add(pi);
      } else if (partial.equals(webSite.getAdminPath())) {
        PageInfo api = new PageInfo(webSite, webSite.getAdminPath());
        api.setTitle("MeshCMS");
        list.add(api);
      }
    }
View Full Code Here

  /**
   * Caches a page.
   */
  public void cache(Path path, byte[] b) {
    if (pageCache != null) {
      pageCache.put(new Path(path), b);
    }
  }
View Full Code Here

    if (dir.isDirectory()) {
      String[] files = dir.list();
     
      if (files != null) {
        for (int i = 0; i < files.length; i++) {
          Path subPath = path.add(files[i]);
         
          if (insideDir == null || webSite.getFile(subPath.add(insideDir)).exists()) {
            map.put(files[i], subPath);
          }
        }
      }
    }
View Full Code Here

      for (int i = 0; iter.hasNext(); i++) {
        redirPaths[i] = ((PageInfo) iter.next()).getPath();
      }
    }
   
    Path result = null;
    int best = 0;
   
    if (Utils.searchString(WebUtils.DEFAULT_WELCOME_FILES,
        requestedPath.getLastElement(), false) >= 0) {
      requestedPath = requestedPath.getPartial(requestedPath.getElementCount() - 1);
    }
   
    if (redirCache.containsKey(requestedPath)) {
      result = (Path) redirCache.get(requestedPath);
    } else {
      Path match = removePageExtension(requestedPath);
     
      for (int i = 0; i < redirPaths.length; i++) {
        String[] commonPart = Utils.commonPart(match.getElements(),
            removePageExtension(redirPaths[i]).getElements(), true);
       
        if (commonPart != null && commonPart.length > best) {
          result = redirPaths[i];
          best = commonPart.length;
View Full Code Here

  private String path;
  private String placeholder;
  private boolean allowHiding = false;

  public void writeTag() throws IOException {
    Path rootPath = (path == null) ?
        webSite.getSiteInfo().getThemeRoot(pagePath) : new Path(path);
    Path script = WebUtils.getThemeFolderPath(request, pageDirPath);
    Writer outWriter = getOut();

    if (part.equals(PART_BODY)) {
      outWriter.write("<!-- Tigra Menu 2.0 -->\n");
      outWriter.write("<script language=\"JavaScript\">\n");
View Full Code Here

TOP

Related Classes of org.meshcms.util.Path

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.