code: private CmsResource createSiteRootIfNeeded(String siteRoot) throws CmsException {
  
          CmsResource siteRootResource = null;
  
          // check if the site root already exists
          try {
              // take the existing site and do not perform any OU related actions
              if (m_cms.existsResource(siteRoot)) {
                  siteRootResource = m_cms.readResource(siteRoot);
              } else {
                  CmsResource onlineVersion = m_cmsOnline.readResource(siteRoot);
                  siteRootResource = m_cms.readResource(onlineVersion.getStructureId());
              }
  
          } catch (CmsVfsResourceNotFoundException e) {
              // not create a new site folder and the according OU if option is checked checked
              getReport().println(
                  Messages.get().container(Messages.RPT_SITE_CREATE_RESOURCES_0),
                  I_CmsReport.FORMAT_DEFAULT);
              I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(
                  CmsResourceTypeFolderSubSitemap.TYPE_SUBSITEMAP);
              siteRootResource = m_cms.createResource(siteRoot, type);
              CmsProperty folderTitle = new CmsProperty(
                  CmsPropertyDefinition.PROPERTY_TITLE,
                  m_site.getTitle(),
                  m_site.getTitle());
              m_cms.writePropertyObject(siteRoot, folderTitle);
  
          }
          return siteRootResource;
      }
docs: Creates root-folder for the new site.<p>
  If folder exist, the existing one will be returned.<p>
  
  @param siteRoot path to be created resp. read.
  @return site root folder
  @throws CmsException exception