Search in sources :

Example 1 with ConnectionEstablishedResponse

use of org.wso2.carbon.identity.api.server.userstore.v1.model.ConnectionEstablishedResponse in project identity-api-server by wso2.

the class ServerUserStoreService method testRDBMSConnection.

/**
 * Check the connection heath for JDBC userstores.
 *
 * @param rdBMSConnectionReq {@link RDBMSConnectionReq}.
 * @return ConnectionEstablishedResponse.
 */
public ConnectionEstablishedResponse testRDBMSConnection(RDBMSConnectionReq rdBMSConnectionReq) {
    UserStoreConfigService userStoreConfigService = UserStoreConfigServiceHolder.getInstance().getUserStoreConfigService();
    ConnectionEstablishedResponse connectionEstablishedResponse = new ConnectionEstablishedResponse();
    boolean isConnectionEstablished;
    connectionEstablishedResponse.setConnection(false);
    try {
        isConnectionEstablished = userStoreConfigService.testRDBMSConnection(rdBMSConnectionReq.getDomain(), rdBMSConnectionReq.getDriverName(), rdBMSConnectionReq.getConnectionURL(), rdBMSConnectionReq.getUsername(), rdBMSConnectionReq.getConnectionPassword(), DUMMY_MESSAGE_ID);
        if (isConnectionEstablished) {
            connectionEstablishedResponse.setConnection(true);
        }
    } catch (IdentityUserStoreMgtException e) {
        connectionEstablishedResponse.setConnection(false);
    }
    return connectionEstablishedResponse;
}
Also used : IdentityUserStoreMgtException(org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException) UserStoreConfigService(org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService) ConnectionEstablishedResponse(org.wso2.carbon.identity.api.server.userstore.v1.model.ConnectionEstablishedResponse)

Aggregations

ConnectionEstablishedResponse (org.wso2.carbon.identity.api.server.userstore.v1.model.ConnectionEstablishedResponse)1 UserStoreConfigService (org.wso2.carbon.identity.user.store.configuration.UserStoreConfigService)1 IdentityUserStoreMgtException (org.wso2.carbon.identity.user.store.configuration.utils.IdentityUserStoreMgtException)1