Package org.wso2.carbon.user.core.tenant

Examples of org.wso2.carbon.user.core.tenant.TenantManager


     * get all the tenants
     * @return Tenant[]
     * @throws UserStoreException, if getting the tenants failed.
     */
    public static Tenant[] getAllTenants() throws UserStoreException {
        TenantManager tenantManager = realmService.getTenantManager();
        try {
            return (Tenant[]) tenantManager.getAllTenants();
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }
    }
View Full Code Here


     * @param domainName domain name
     * @throws RegistryException, if failed.
     * @return, true if avaiable to register.
     */
    public static boolean checkDomainAvailability(String domainName) throws RegistryException {
        TenantManager tenantManager = Util.getTenantManager();
        int tenantId;
        try {
            tenantId = tenantManager.getTenantId(domainName);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            String msg = "Error in checking the domain availability.";
            log.error(msg);
            // we are instead send the tenant id.
            tenantId = -1;
View Full Code Here

     * @return true, if the domain is avaialable to register
     * @throws Exception, if unable to get the tenant manager, or get the tenant id
     *                    from manager.
     */
    public boolean checkDomainAvailability(String domainName) throws Exception {
        TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager();
        int tenantId = tenantManager.getTenantId(domainName);
        if (log.isDebugEnabled()) {
            log.debug("Tenant Domain is available to register.");
        }
        return tenantId < 0; // no tenant exists with the same tenant domain
    }
View Full Code Here

     *         credentials.
     * @throws Exception, if confirmation key doesn't exist in the registry.
     */
    public boolean proceedUpdateCredentials(String domain, String confirmationKey) throws Exception {

        TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager();
        int tenantId;

        try {
            tenantId = tenantManager.getTenantId(domain);
        } catch (UserStoreException e) {
            String msg = "Error in getting tenant, tenant domain: " + domain + ".";
            log.error(msg);
            throw new RegistryException(msg, e);
        }
View Full Code Here

     * @param tenantDomain tenant domain
     * @throws Exception , UserStoreException in retrieving the tenant id or
     *                   activating the tenant.
     */
    public static void activateTenant(String tenantDomain) throws Exception {
        TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager();
        int tenantId;
        try {
            tenantId = tenantManager.getTenantId(tenantDomain);
        } catch (UserStoreException e) {
            String msg = "Error in retrieving the tenant id for the tenant domain: " + tenantDomain
                         + ".";
            log.error(msg);
            throw new Exception(msg, e);
        }

        try {
            tenantManager.activateTenant(tenantId);
        } catch (UserStoreException e) {
            String msg = "Error in activating the tenant for tenant domain: " + tenantDomain + ".";
            log.error(msg);
            throw new Exception(msg, e);
        }
View Full Code Here

     * @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);
View Full Code Here

     * @param domainName tenant domain
     * @param adminName  tenant admin
     * @param email      associated tenant email address
     */
    public static void notifyTenantCreation(String domainName, String adminName, String email) {
        TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager();
        String firstName = "";
        try {
            int tenantId = tenantManager.getTenantId(domainName);
            Tenant tenant = (Tenant) tenantManager.getTenant(tenantId);
            firstName = ClaimsMgtUtil.getFirstName(TenantMgtServiceComponent.getRealmService(),
                                                   tenant, tenantId);
        } catch (Exception e) {
            String msg = "Unable to get the tenant with the tenant domain";
            log.error(msg, e);
View Full Code Here

     * @param email      - tenant email
     * @return the parameters
     */
    private static Map<String, String> initializeSuperTenantNotificationParams(
            String domainName, String adminName, String email) {
        TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager();
        String firstName = "";
        String lastName = "";
        try {
            int tenantId = tenantManager.getTenantId(domainName);
            Tenant tenant = (Tenant) tenantManager.getTenant(tenantId);
            firstName = ClaimsMgtUtil.getFirstName(TenantMgtServiceComponent.getRealmService(),
                                                   tenant, tenantId);
            lastName = ClaimsMgtUtil.getLastName(TenantMgtServiceComponent.getRealmService(),
                                                 tenant, tenantId);

View Full Code Here

     *
     * @return List<TenantInfoBean>
     * @throws Exception UserStorException
     */
    private List<TenantInfoBean> getAllTenants() throws Exception {
        TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager();
        Tenant[] tenants;
        try {
            tenants = (Tenant[]) tenantManager.getAllTenants();
        } catch (UserStoreException e) {
            String msg = "Error in retrieving the tenant information.";
            log.error(msg, e);
            throw new Exception(msg, e);
        }
View Full Code Here

     * @param tenantDomain tenant domain
     * @return tenantInfoBean
     * @throws Exception UserStoreException
     */
    public TenantInfoBean getTenant(String tenantDomain) throws Exception {
        TenantManager tenantManager = TenantMgtServiceComponent.getTenantManager();

        int tenantId;
        try {
            tenantId = tenantManager.getTenantId(tenantDomain);
        } catch (UserStoreException e) {
            String msg = "Error in retrieving the tenant id for the tenant domain: " +
                         tenantDomain + ".";
            log.error(msg);
            throw new Exception(msg, e);
        }
        Tenant tenant;
        try {
            tenant = (Tenant) tenantManager.getTenant(tenantId);
        } catch (UserStoreException e) {
            String msg = "Error in retrieving the tenant from the tenant manager.";
            log.error(msg);
            throw new Exception(msg, e);
        }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.core.tenant.TenantManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.