Search in sources :

Example 1 with RegistryService

use of org.wso2.carbon.registry.core.service.RegistryService in project jaggery by wso2.

the class RegistryHostObject method getRegistry.

private static UserRegistry getRegistry(String username, String password) throws ScriptException {
    UserRegistry registry;
    RegistryService registryService = RegistryHostObjectContext.getRegistryService();
    String tDomain = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantDomain(false);
    try {
        int tId = RegistryHostObjectContext.getRealmService().getTenantManager().getTenantId(tDomain);
        registry = registryService.getGovernanceUserRegistry(username, password, tId);
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new ScriptException(e);
    }
    if (registry == null) {
        String msg = "User governance registry cannot be retrieved";
        throw new ScriptException(msg);
    }
    return registry;
}
Also used : ScriptException(org.jaggeryjs.scriptengine.exceptions.ScriptException) UserRegistry(org.wso2.carbon.registry.core.session.UserRegistry) RegistryService(org.wso2.carbon.registry.core.service.RegistryService) RegistryException(org.wso2.carbon.registry.api.RegistryException) IndexerException(org.wso2.carbon.registry.indexing.indexer.IndexerException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) CarbonException(org.wso2.carbon.CarbonException) ScriptException(org.jaggeryjs.scriptengine.exceptions.ScriptException)

Aggregations

ScriptException (org.jaggeryjs.scriptengine.exceptions.ScriptException)1 CarbonException (org.wso2.carbon.CarbonException)1 RegistryException (org.wso2.carbon.registry.api.RegistryException)1 RegistryService (org.wso2.carbon.registry.core.service.RegistryService)1 UserRegistry (org.wso2.carbon.registry.core.session.UserRegistry)1 IndexerException (org.wso2.carbon.registry.indexing.indexer.IndexerException)1 UserStoreException (org.wso2.carbon.user.core.UserStoreException)1