* @param tenant tenant
* @return true, if the chosen name is available to register
* @throws Exception, if unable to get the tenant id or if a tenant with same domain exists.
*/
public static boolean isDomainNameAvailable(Tenant tenant) throws Exception {
TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager();
String tenantDomain = tenant.getDomain();
// The registry reserved words are checked first.
if (tenantDomain.equals("atom") || tenantDomain.equals("registry") ||
tenantDomain.equals("resource")) {
String msg = "You can not use a registry reserved word:" + tenantDomain +
":as a tenant domain. Please choose a different one.";
log.error(msg);
throw new Exception(msg);
}
int tenantId;
try {
tenantId = tenantManager.getTenantId(tenantDomain);
} catch (UserStoreException e) {
String msg = "Error in getting the tenant id for the given domain " +
tenant.getDomain() + ".";
log.error(msg);
throw new Exception(msg, e);