code: public void addSite(CmsObject cms, CmsSite site) throws CmsException {
  
          // check permissions
          if (OpenCms.getRunLevel() > OpenCms.RUNLEVEL_1_CORE_OBJECT) {
              // simple unit tests will have runlevel 1 and no CmsObject
              OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER);
          }
  
          // un-freeze
          m_frozen = false;
  
          // set aliases and parameters, they will be used in the addSite method
          // this is necessary because of a digester workaround
          m_siteParams = site.getParameters();
          m_aliases = site.getAliases();
  
          String secureUrl = null;
          if (site.hasSecureServer()) {
              secureUrl = site.getSecureUrl();
          }
  
          // add the site
          addSite(
              site.getUrl(),
              site.getSiteRoot(),
              site.getTitle(),
              Float.toString(site.getPosition()),
              site.getErrorPage(),
              Boolean.toString(site.isWebserver()),
              site.getSSLMode().getXMLValue(),
              secureUrl,
              Boolean.toString(site.isExclusiveUrl()),
              Boolean.toString(site.isExclusiveError()),
              Boolean.toString(site.usesPermanentRedirects()));
  
          // re-initialize, will freeze the state when finished
          initialize(cms);
          OpenCms.writeConfiguration(CmsSitesConfiguration.class);
      }
docs: Adds a site.<p>
  
  @param cms the CMS object
  @param site the site to add
  
  @throws CmsException if something goes wrong