/**
   * @param domainId
   * @return DomainDriver
   */
  public DomainDriver getDomainDriver(int domainId) throws Exception {
    DomainDriver domainDriver = null;
    boolean osAllocated = false;
    try {
      domainDriver = domainDriverInstances.get(idAsString(domainId));
      if (domainDriver == null) {
        // Set the OrganizationSchema (if not already done)
        getOrganizationSchema();
        osAllocated = true;

        // Get the domain information
        DomainRow dr = getOrganization().domain.getDomain(domainId);
        if (dr == null) {
          throw new AdminException(
              "DomainDriverManager.getDomainDriver",
              SilverpeasException.ERROR,
              "admin.EX_ERR_DOMAIN_NOT_FOUND",
              "domain Id: '" + domainId + "'");
        }

        // Get the driver class name
        try {
          domainDriver = DomainDriverFactory.getDriver(dr.className);
          domainDriver.init(domainId, dr.propFileName, dr.authenticationServer);
        } catch (ClassNotFoundException e) {
          throw new AdminException(
              "DomainDriverManager.getDomainDriver",
              SilverpeasException.ERROR,
              "root.EX_CLASS_NOT_FOUND",
              e);
        } catch (IllegalAccessException e) {
          throw new AdminException(
              "DomainDriverManager.getDomainDriver",
              SilverpeasException.ERROR,
              "root.EX_ILLEGAL_ACCESS",
              e);
        } catch (InstantiationException e) {
          throw new AdminException(
              "DomainDriverManager.getDomainDriver",
              SilverpeasException.ERROR,
              "root.EX_INSTANTIATION",
              e);
        }

        // Save DomainDriver instance
        domainDriverInstances.put(idAsString(domainId), domainDriver);
      }
    } catch (AdminPersistenceException e) {
      throw new AdminException(
          "DomainDriverManager.getDomainDriver",
          SilverpeasException.ERROR,
          "admin.EX_ERR_GET_DOMAIN_DRIVER",
          "domain id: '" + domainId + "'",
          e);
    } finally {
      if (osAllocated) {
        releaseOrganizationSchema();
      }
    }
    return domainDriver;
  }