Returns the fav icon path for the given site.<p>

@param siteRoot the site root

@return the icon path
500173
public Resource getFavIcon(String siteRoot) {

        CmsResource iconResource = null;
        try {
            iconResource = getRootCmsObject().readResource(siteRoot + "/" + CmsSiteManager.FAVICON);
        } catch (CmsException e) {
            //no favicon there
        }
        if (iconResource != null) {
            return new ExternalResource(
                OpenCms.getLinkManager().getPermalink(getRootCmsObject(), iconResource.getRootPath()));
        }
        return new CmsCssIcon(OpenCmsTheme.ICON_SITE);
    }
412961
public String getIconPath(CmsListItem item) {

        try {
            CmsUser user = getCms().readUser((String)item.get(LIST_COLUMN_LOGIN));
            if (user.getOuFqn().equals(getParamOufqn())) {
                return A_CmsUsersList.PATH_BUTTONS + "user.png";
            } else {
                return A_CmsUsersList.PATH_BUTTONS + "user_other_ou.png";
            }
        } catch (CmsException e) {
            return A_CmsUsersList.PATH_BUTTONS + "user.png";
        }
    }
314262
private String getRootNode() {

        CmsResource resource = null;
        String title = null;
        String folder = getRootFolder();
        try {
            resource = getCms().readFolder(folder, CmsResourceFilter.IGNORE_EXPIRATION);
            // get the title information of the folder
            CmsProperty titleProperty = getCms().readPropertyObject(
                folder,
                CmsPropertyDefinition.PROPERTY_TITLE,
                false);

            if ((titleProperty == null) || titleProperty.isNullProperty()) {
                getCms().getSitePath(resource);
                title = resource.getRootPath();
            } else {
                title = titleProperty.getValue();
            }
            return getNode(resource.getRootPath(), title, resource.getTypeId(), true, resource.getState(), false);
        } catch (CmsException e) {
            // should usually never happen
            if (LOG.isInfoEnabled()) {
                LOG.info(e);
            }
        }
        return "";
    }
959200
public String getBaseToolPath(CmsWorkplace wp) {

        CmsToolUserData userData = getUserData(wp);
        String path = TOOLPATH_SEPARATOR;
        if (userData != null) {
            path = userData.getBaseTool(getCurrentRoot(wp).getKey());
        }
        return path;
    }
363128
private String toPath(String name, IconSize size) {

        return CmsStringUtil.joinPaths(CmsWorkplace.getSkinUri(), ICON_FOLDER, "" + name.hashCode()) + size.getSuffix();
    }
18421
public void onReceiveSitemapPreloadData(CmsSitemapEntryBean sitemapPreloadData) {

        fillWithPreloadInfo(Collections.singletonList(sitemapPreloadData));
        String siteRoot = sitemapPreloadData.getSiteRoot();
        if (siteRoot != null) {
            selectSite(siteRoot);
        }
    }
1357338
public static String getRootRelativePath(String url) {

		Matcher matcher = URL_SEPARATOR_PATTERN.matcher(url);
		StringBuffer result = new StringBuffer();
		boolean first = true;
		while (matcher.find()) {
			if (first) {
				matcher.appendReplacement(result, "");
				first = false;
			} else {
				matcher.appendReplacement(result, ROOT_REPLACE_PATTERN);
			}
		}

		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;
	}
472978
private static String getRootPath(final String locationPattern) {

        int rootDirEnd = locationPattern.length();

        while (AntPathMatcher.isPattern(locationPattern.substring(0, rootDirEnd))) {
            rootDirEnd = locationPattern.lastIndexOf('/', rootDirEnd - 2) + 1;
        }
        return locationPattern.substring(0, rootDirEnd);
    }
1179157
private void saveFavIcon(String siteRoot) {

        if (m_os == null) {
            return;
        }
        if (m_os.size() == 0) {
            return;
        }

        getReport().println(Messages.get().container(Messages.RPT_SITE_SET_FAVICON_0), I_CmsReport.FORMAT_DEFAULT);
        CmsResource favicon = null;
        try {
            favicon = m_cms.createResource(
                siteRoot + CmsSiteManager.FAVICON,
                OpenCms.getResourceManager().getResourceType(CmsResourceTypeImage.getStaticTypeName()));
        } catch (CmsVfsResourceAlreadyExistsException e) {
            //OK, Resource already there
            try {
                favicon = m_cms.readResource(siteRoot + CmsSiteManager.FAVICON);
            } catch (CmsException e2) {
                //no, it wasn't..
                getReport().println(
                    Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0),
                    I_CmsReport.FORMAT_ERROR);
                getReport().println(e);
                getReport().println(e2);
                return;
            }
        } catch (CmsIllegalArgumentException | CmsException e) {
            getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0), I_CmsReport.FORMAT_ERROR);
            getReport().println(e);
            return;
        }
        try {
            m_cms.lockResource(siteRoot + CmsSiteManager.FAVICON);
            CmsFile faviconFile = new CmsFile(favicon);
            faviconFile.setContents(m_os.toByteArray());
            m_cms.writeFile(faviconFile);
            m_cms.unlockResource(siteRoot + CmsSiteManager.FAVICON);
        } catch (CmsException e) {
            getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0), I_CmsReport.FORMAT_ERROR);
            getReport().println(e);
            return;
        }

    }
575492
private void createIndexHTML(String siteRoot) throws CmsIllegalArgumentException, CmsException {

        if (!m_cms.existsResource(siteRoot + INDEX_HTML)) {
            //Create index.html
            I_CmsResourceType containerType = OpenCms.getResourceManager().getResourceType(
                org.opencms.file.types.CmsResourceTypeXmlContainerPage.RESOURCE_TYPE_NAME);
            m_cms.createResource(siteRoot + INDEX_HTML, containerType);
        }
    }
555816
public boolean isSiteRoot(String rootPath) {

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

    }
35964
private static String getContextRootPath(CmsObject cms, String creationSitemap) {

        String path = null;
        if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(creationSitemap)) {
            try {
                path = cms.readFolder(creationSitemap).getRootPath();
            } catch (CmsException e) {
                LOG.warn("The provided creation sitemap " + creationSitemap + " is not a VFS folder.", e);
            }
        }
        if (path == null) {
            path = cms.addSiteRoot(cms.getRequestContext().getFolderUri());
        }

        return path;
    }
1167001
public JTree getTreeSite() {
		if (treeSite == null) {
			treeSite = new JTree(new DefaultTreeModel(new DefaultMutableTreeNode()));
			treeSite.setShowsRootHandles(true);
			treeSite.setName("treeSite");
			treeSite.setToggleClickCount(1);

			// Force macOS L&F to query the row height from SiteMapTreeCellRenderer to hide the filtered nodes.
			// Other L&Fs hide the filtered nodes by default.
			LookAndFeel laf = UIManager.getLookAndFeel();
			if (laf != null && Constant.isMacOsX()
					&& UIManager.getSystemLookAndFeelClassName().equals(laf.getClass().getName())) {
				treeSite.setRowHeight(0);
			}

			treeSite.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() { 

				@Override
				public void valueChanged(javax.swing.event.TreeSelectionEvent e) {    

				    SiteNode node = (SiteNode) treeSite.getLastSelectedPathComponent();
				    if (node == null) {
				        return;
				    }
				    if (!node.isRoot()) {
				    	HttpMessage msg = null;
                        try {
                            msg = node.getHistoryReference().getHttpMessage();
                        } catch (Exception e1) {
                        	// ZAP: Log exceptions
                        	log.warn(e1.getMessage(), e1);
                            return;
                            
                        }

                        getView().displayMessage(msg);

			        	// ZAP: Call SiteMapListenners
			            for (SiteMapListener listener : listeners) {
			            	listener.nodeSelected(node);
			            }
				    } else {
				    	// ZAP: clear the views when the root is selected
				        getView().displayMessage(null);
				    }
	
				}
			});
	        treeSite.setComponentPopupMenu(new SitesCustomPopupMenu());

			// ZAP: Add custom tree cell renderer.
	        DefaultTreeCellRenderer renderer = new SiteMapTreeCellRenderer(listeners);
			treeSite.setCellRenderer(renderer);

			String deleteSiteNode = "zap.delete.sitenode";
			treeSite.getInputMap().put(getView().getDefaultDeleteKeyStroke(), deleteSiteNode);
			treeSite.getActionMap().put(deleteSiteNode, new AbstractAction() {

				private static final long serialVersionUID = 1L;

				@Override
				public void actionPerformed(ActionEvent e) {
					ExtensionHistory extHistory = Control.getSingleton().getExtensionLoader().getExtension(
							ExtensionHistory.class);
					if (extHistory == null || treeSite.getSelectionCount() == 0) {
						return;
					}

					int result = View.getSingleton().showConfirmDialog(Constant.messages.getString("sites.purge.warning"));
					if (result != JOptionPane.YES_OPTION) {
						return;
					}

					SiteMap siteMap = Model.getSingleton().getSession().getSiteTree();
					for (TreePath path : treeSite.getSelectionPaths()) {
						extHistory.purge(siteMap, (SiteNode) path.getLastPathComponent());
					}
				}
			});
		}
		return treeSite;
	}
93874
protected String getName(String sitePath) {

        String name = CmsResource.getName(sitePath);
        if (name.endsWith("/")) {
            name = name.substring(0, name.length() - 1);
        }
        return name;

    }
1213763
public static String getBasePath(String siteConfigFile) {

        if (siteConfigFile.endsWith(CmsADEManager.CONFIG_SUFFIX)) {
            return CmsResource.getParentFolder(CmsResource.getParentFolder(siteConfigFile));
        }
        return null;
    }
619557
public void updateSite(String siteRoot) {

        try {
            CmsObject cloneCms = OpenCms.initCmsObject(m_cms);
            if (siteRoot == null) {
                siteRoot = "/system";
            }
            cloneCms.getRequestContext().setSiteRoot(siteRoot);
            m_cms = cloneCms;
        } catch (CmsException e1) {
            LOG.error(e1.getLocalizedMessage(), e1);
        }
        updateValidation();
    }