1 22 23 package org.meshcms.core; 24 25 import java.io.*; 26 import org.meshcms.util.*; 27 28 31 public class CMSDirectoryFinder extends DirectoryParser { 32 private Path cmsPath; 33 private boolean virtualSite; 34 private String idFileName; 35 36 44 public CMSDirectoryFinder(File siteRoot, boolean virtualSite) { 45 setRecursive(true); 46 setInitialDir(siteRoot); 47 this.virtualSite = virtualSite; 48 idFileName = virtualSite ? WebSite.CMS_ID_FILE : WebSite.ADMIN_ID_FILE; 49 } 50 51 protected void processFile(File file, Path path) { 52 } 54 55 protected boolean preProcessDirectory(File file, Path path) { 56 if (cmsPath != null) { 57 return false; 58 } 59 60 File vFile = new File(file, idFileName); 61 62 if (vFile.exists()) { 63 cmsPath = virtualSite ? path : path.getParent(); 64 return false; 65 } 66 67 return true; 68 } 69 70 75 public Path getCMSPath() { 76 if (cmsPath == null) { 77 process(); 78 } 79 80 return cmsPath; 81 } 82 } 83 | Popular Tags |