/** * @param domainId * @return String */ public Domain getDomain(String domainId) throws Exception { Domain valret = null; try { // Set the OrganizationSchema (if not already done) getOrganizationSchema(); // Get the domain information DomainRow dr = getOrganization().domain.getDomain(idAsInt(domainId)); if (dr == null) { throw new AdminException( "DomainDriverManager.getDomain", SilverpeasException.ERROR, "admin.EX_ERR_DOMAIN_NOT_FOUND", "domain Id: '" + domainId + "'"); } valret = new Domain(); valret.setId(Integer.toString(dr.id)); valret.setName(dr.name); valret.setDescription(dr.description); valret.setDriverClassName(dr.className); valret.setPropFileName(dr.propFileName); valret.setAuthenticationServer(dr.authenticationServer); valret.setTheTimeStamp(dr.theTimeStamp); valret.setSilverpeasServerURL(dr.silverpeasServerURL); } catch (AdminPersistenceException e) { throw new AdminException( "DomainDriverManager.getDomain", SilverpeasException.ERROR, "admin.EX_ERR_GET_DOMAIN", "domain id: '" + domainId + "'", e); } finally { releaseOrganizationSchema(); } return valret; }
public String createDomain(Domain theDomain) throws Exception { try { startTransaction(false); DomainRow dr = new DomainRow(); dr.id = -1; dr.name = theDomain.getName(); dr.description = theDomain.getDescription(); dr.className = theDomain.getDriverClassName(); dr.propFileName = theDomain.getPropFileName(); dr.authenticationServer = theDomain.getAuthenticationServer(); dr.theTimeStamp = theDomain.getTheTimeStamp(); dr.silverpeasServerURL = theDomain.getSilverpeasServerURL(); // Create domain getOrganization().domain.createDomain(dr); this.commit(); LoginPasswordAuthentication.initDomains(); return idAsString(dr.id); } catch (AdminException e) { try { rollback(); } catch (Exception e1) { SilverTrace.error("admin", "DomainDriverManager.createDomain", "root.EX_ERR_ROLLBACK", e1); } throw new AdminException( "DomainDriverManager.createDomain", SilverpeasException.ERROR, "admin.EX_ERR_ADD_DOMAIN", "domain name: '" + theDomain.getName() + "'", e); } finally { releaseOrganizationSchema(); } }