Helper method to retrieve the parent folder type or <code>null</code> if none available.<p>

@param rootPath the path of a resource
@return the parent folder content type
348900
public String getParentFolderType(String rootPath) {

        String parent = CmsResource.getParentFolder(rootPath);
        if (parent == null) {
            return null;
        }
        String type = m_folderTypes.get(parent);
        // type may be null
        return type;
    }
1003208
public static String getParentFolderTokens(String rootPath) {

        if (CmsStringUtil.isEmpty(rootPath)) {
            return "/";
        }
        StringBuffer result = new StringBuffer(128);
        String folderName = CmsResource.getFolderPath(rootPath);
        for (int i = 0; i < folderName.length(); i++) {
            char c = folderName.charAt(i);
            if (c == '/') {
                if (result.length() > 0) {
                    result.append(' ');
                }
                result.append(folderName.substring(0, i + 1));
            }
        }
        return result.toString();
    }
1329892
public static String getRootClassPath() {
		if (rootClassPath == null) {
			try {
				// String path = PathKit.class.getClassLoader().getResource("").toURI().getPath();
				String path = getClassLoader().getResource("").toURI().getPath();
				rootClassPath = new File(path).getAbsolutePath();
			}
			catch (Exception e) {
				// String path = PathKit.class.getClassLoader().getResource("").getPath();
				// String path = getClassLoader().getResource("").getPath();
				// rootClassPath = new File(path).getAbsolutePath();
				
				try {
					String path = PathKit.class.getProtectionDomain().getCodeSource().getLocation().getPath();
					path = java.net.URLDecoder.decode(path, "UTF-8");
					if (path.endsWith(File.separator)) {
						path = path.substring(0, path.length() - 1);
					}
					rootClassPath = path;
				} catch (UnsupportedEncodingException e1) {
					throw new RuntimeException(e1);
				}
			}
		}
		return rootClassPath;
	}
1022561
private String getParentFolder() {

        String relativeTo;
        if (isDirectPublish()) {
            relativeTo = CmsResource.getParentFolder(getResourceList().get(0));
        } else {
            relativeTo = getCms().getRequestContext().getSiteRoot() + "/";
        }
        return relativeTo;
    }
297226
public CMFolder getFolder( CPath path )
    {
        List<String> baseNames = path.split();

        if (path.isRoot() ){
            return this;
        }

        CMFolder currentFolder = this;
        CMFolder subFolder = null;

        for ( String baseName : baseNames ) {
            subFolder = currentFolder.getChildByName( baseName );

            if ( subFolder == null ) {
                return null;
            }

            currentFolder = subFolder;
        }

        return subFolder;
    }
386816
List<String> getAncestorPaths(String path) {

        List<String> result = Lists.newArrayList();
        while (path != null) {
            result.add(path);
            path = CmsResource.getParentFolder(path);
        }
        return result;
    }
740081
public static FileStatus getRootFileStatus(Path rootPath) {
        return new FileStatus(0, true, 1, 1024, -1, -1, DIRECTORY_PERMISSION, null, null, rootPath);
    }
256948
public Locale getMainLocale(String rootPath) {

        CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(rootPath);
        if (site == null) {
            return null;
        }
        return site.getMainTranslationLocale(null);
    }
1310544
protected List<CmsResource> getSitemapSubEntryResources(String rootPath) throws CmsException {

        CmsObject rootCms = OpenCms.initCmsObject(getCmsObject());
        List<CmsResource> result = new ArrayList<CmsResource>();
        rootCms.getRequestContext().setSiteRoot("");
        CmsJspNavBuilder navBuilder = new CmsJspNavBuilder(rootCms);
        for (CmsJspNavElement navElement : navBuilder.getNavigationForFolder(
            rootPath,
            Visibility.all,
            CmsResourceFilter.ONLY_VISIBLE)) {
            if ((navElement != null) && navElement.isInNavigation()) {
                result.add(navElement.getResource());
            }
        }
        return result;
    }
895207
public T simonTypeImg(SimonType simonType, String rootPath) throws IOException {
		String image = null;
		switch (simonType) {
			case COUNTER:
				image = "TypeCounter.png";
				break;
			case STOPWATCH:
				image = "TypeStopwatch.png";
				break;
			case UNKNOWN:
				image = "TypeUnknown.png";
				break;
		}
		String label = simonType.name().toLowerCase();
		doBegin("img", null, label + " icon");
		attr("src", rootPath + "resource/images/" + image);
		attr("alt", label);
		writer.write(" />");
		return (T) this;
	}
555816
public boolean isSiteRoot(String rootPath) {

        String siteRoot = getSiteRoot(rootPath);
        rootPath = CmsStringUtil.joinPaths(rootPath, "/");
        return rootPath.equals(siteRoot);

    }
470668
@Override
	public String getFilePath(String resourcePath) {

		String filePath = null;
		String path = getCompletePath(resourcePath);
		URL url = null;
		try {
			url = ClassLoaderResourceUtils.getResourceURL(path, this);
			String strURL = url.toString();
			if (strURL.startsWith(JawrConstant.FILE_URL_PREFIX)) {
				filePath = new File(url.getFile()).getAbsolutePath();
			} else if (strURL.startsWith(JawrConstant.JAR_URL_PREFIX + JawrConstant.FILE_URL_PREFIX)) {
				String tmp = strURL.substring((JawrConstant.JAR_URL_PREFIX + JawrConstant.FILE_URL_PREFIX).length());
				int idxJarContentSeparator = tmp.indexOf("!");
				if (idxJarContentSeparator != -1) {
					tmp = tmp.substring(0, idxJarContentSeparator);
				}
				filePath = new File(tmp).getAbsolutePath();
			}
		} catch (ResourceNotFoundException e) {
			filePath = null;
		}

		return filePath;
	}
931264
public static String getParentPath(final String path) {
    final int pos = path.lastIndexOf(File.separator);
    if (pos <= 0) {
      return null;
    }
    return path.substring(0, pos);
  }
421338
public static String getParentDirectory(String filePath) throws IllegalArgumentException {
        if (Pattern.matches(sPatternUrl, filePath))
            return getURLParentDirectory(filePath);

        return new File(filePath).getParent();
    }
1266566
@Override
	public String getResourcePath(String basePath, String relativePath) {

		String result = null;
		if (binaryGeneratorRegistry.isGeneratedBinaryResource(relativePath)) {
			result = relativePath;
		} else if (contextPath != null && relativePath.startsWith(contextPath)) {
			result = relativePath.substring(contextPath.length() - 1);
		} else {
			result = PathNormalizer.concatWebPath(basePath, relativePath);
		}
		return result;
	}
1311728
public static Locale getLocaleFromPath(String sitePath) {

        Locale result = null;
        if (sitePath.indexOf("/") == 0) {
            sitePath = sitePath.substring(1);
        }
        if (sitePath.length() > 1) {
            String localePrefix;
            if (!sitePath.contains("/")) {
                // this may be the case for paths pointing to the root folder of a site
                // check for parameters
                int separator = -1;
                int param = sitePath.indexOf("?");
                int hash = sitePath.indexOf("#");
                if (param >= 0) {
                    if (hash != 0) {
                        separator = param < hash ? param : hash;
                    } else {
                        separator = param;
                    }
                } else {
                    separator = hash;
                }
                if (separator >= 0) {
                    localePrefix = sitePath.substring(0, separator);
                } else {
                    localePrefix = sitePath;
                }
            } else {
                localePrefix = sitePath.substring(0, sitePath.indexOf("/"));
            }
            Locale locale = CmsLocaleManager.getLocale(localePrefix);
            if (localePrefix.equals(locale.toString())
                && OpenCms.getLocaleManager().getAvailableLocales().contains(locale)) {
                result = locale;
            }
        }
        return result;
    }
1093463
private static String getNormalizedParent(String filePath) {
        if (new File(filePath).getParent() == null) {
            // parent doesn't exist .. return null
            return null;
        }

        String parentDir = filePath.substring(0, filePath.lastIndexOf("/"));

        if (!parentDir.contains("/")) {
            //catch cases where filePath is something like C:/temp.zip or /home.zip
            parentDir = parentDir + "/";
        }

        return parentDir;
    }