Package org.wso2.carbon.user.core

Examples of org.wso2.carbon.user.core.UserStoreException


    private Claim[] getClaimsToEnterData(UserRealm realm)
            throws UserStoreException {
        try {
            return getAllSupportedClaims(realm, UserCoreConstants.DEFAULT_CARBON_DIALECT);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }
    }
View Full Code Here


        ProfileConfiguration[] configurations;
        String[] profileNames = new String[0];
        try {
            configurations = (ProfileConfiguration[]) profileAdmin.getAllProfiles();
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserStoreException(e);
        }

        if (configurations != null) {
            profileNames = new String[configurations.length];
            for (int i = 0; i < configurations.length; i++) {
View Full Code Here

        } catch (DirectoryServerException e) {
            //exception can be caught if addPartition method fails.
            String errorMessage = "Could not create a new partition for tenant id - " +
                                  tenant.getId() + "and for tenant domain - " + tenant.getDomain();
            logger.error(errorMessage, e);
            throw new UserStoreException(errorMessage, e);
        } catch (EmbeddingLDAPException e) {
            //exception can be caught if getPartitionInfo method fails.
            String errorMessage = "Could not create a new partition for tenant id - " +
                                  tenant.getId() + "and for tenant domain - " + tenant.getDomain();
            logger.error(errorMessage, e);
            throw new UserStoreException(errorMessage, e);

        }

        return tenant.getId();
    }
View Full Code Here

    public void deleteTenant(int i) throws UserStoreException {

        try {
            this.ldapPartitionManager.removePartition(String.valueOf(i));
        } catch (Exception e) {
            throw new UserStoreException("Could not remove partition for tenant id " + i, e);
        }
    }
View Full Code Here

    public void addPartitionToTenant(Tenant tenant) throws UserStoreException {
        try {
            ldapPartitionManager.initializeExistingPartition(getPartitionInfo(tenant));

        } catch (Exception e) {
            throw new UserStoreException("Can not add the new partition ", e);
        }
    }
View Full Code Here

            realmConfig.getRealmProperties().remove(JDBCRealmConstants.MAX_WAIT);
           
            return realmConfig;
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new UserStoreException(e.getMessage(), e);
        }
    }
View Full Code Here

            try {
                context = new InitialDirContext(environment);
            } catch (Exception e1) {
                log.error("Error obtaining connection for the second time" + e.getMessage(), e);
                throw new UserStoreException("Error obtaining connection. " + e.getMessage(), e);
            }

        }
        return (context);
View Full Code Here

            return ldapRealmConfig;

        } catch (Exception e) {
            String errorMessage = "Tenant specific realm config could not be created.";
            log.error(errorMessage, e);
            throw new UserStoreException(errorMessage, e);
        }

    }
View Full Code Here

        if (jdbcDataSource == null) {
            jdbcDataSource = DatabaseUtil.getRealmDataSource(realmConfig);
            properties.put(UserCoreConstants.DATA_SOURCE, jdbcDataSource);
        }
        if (jdbcDataSource == null) {
            throw new UserStoreException("Data Source is null");
        }

        if (log.isDebugEnabled()) {
            log.debug("The jdbcDataSource being used by JDBCUserStoreManager :: "
                    + jdbcDataSource.hashCode());
View Full Code Here

            List<String> lst = new LinkedList<String>();

            dbConnection = getDBConnection();

            if (dbConnection == null) {
                throw new UserStoreException("null connection");
            }
            dbConnection.setAutoCommit(false);
            dbConnection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
            sqlStmt = realmConfig.getUserStoreProperty(JDBCRealmConstants.GET_USER_FILTER);

            prepStmt = dbConnection.prepareStatement(sqlStmt);
            prepStmt.setString(1, filter);
            if (sqlStmt.contains(UserCoreConstants.UM_TENANT_COLUMN)) {
                prepStmt.setInt(2, tenantId);
            }

            rs = prepStmt.executeQuery();

            while (rs.next()) {
                if (i < maxItemLimit) {
                    String name = rs.getString(1);
                    if(CarbonConstants.REGISTRY_ANONNYMOUS_USERNAME.equals(name)){
                        continue;
                    }
                    lst.add(name);
                } else {
                    break;
                }
                i++;
            }
            rs.close();

            if (lst.size() > 0) {
                users = (String[]) lst.toArray(new String[lst.size()]);
            }

        } catch (SQLException e) {
            log.error(e.getMessage(), e);
            log.error("Using sql : " + sqlStmt);
            throw new UserStoreException(e.getMessage(), e);
        } finally {
            DatabaseUtil.closeAllConnections(dbConnection, rs, prepStmt);
        }
        return users;
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.core.UserStoreException

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.