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;
}
Aggregations