if (tenantDomain != null) {
if (RegistryContext.getBaseInstance().getRealmService() == null) {
String msg = "Error in getting the tenant manager. " +
"The realm service is not available.";
log.error(msg);
return new ResponseTarget(context, new EmptyResponseContext(400, msg));
}
TenantManager tenantManager =
RegistryContext.getBaseInstance().getRealmService().
getTenantManager();
try {
calledTenantId = tenantManager.getTenantId(tenantDomain);
} catch (org.wso2.carbon.user.api.UserStoreException e) {
String msg =
"Error in converting tenant domain to the id for tenant domain: " +
tenantDomain + ".";
log.error(msg, e);
return new ResponseTarget(context, new EmptyResponseContext(400, msg));
}
try {
if (!tenantManager.isTenantActive(calledTenantId)) {
// the tenant is not active.
String msg =
"The tenant is not active. tenant domain: " + tenantDomain +
".";
log.error(msg);
return new ResponseTarget(context, new EmptyResponseContext(400, msg));
}
} catch (org.wso2.carbon.user.api.UserStoreException e) {
String msg =
"Error in converting tenant domain to the id for tenant domain: " +
tenantDomain + ".";
log.error(msg, e);
return new ResponseTarget(context, new EmptyResponseContext(400, msg));
}
RegistryContext.getBaseInstance().
getRealmService().getBootstrapRealmConfiguration();
}
String anonUser = CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME;
try {
registry = embeddedRegistryService.getRegistry(anonUser, calledTenantId);
} catch (RegistryException e) {
String msg = "Error in creating the registry.";
log.error(msg, e);
return new ResponseTarget(context, new EmptyResponseContext(400, msg));
}
}
}
// Squirrel this away so the adapter can get it later (after all that work we just did!)