Search in sources :

Example 11 with RestResponseStatus

use of com.thinkbiganalytics.rest.model.RestResponseStatus in project kylo by Teradata.

the class DataSourceController method doListTables.

private List<DataSetTable> doListTables(@QueryParam("catalog") String catalogName, @QueryParam("schema") String schemaName, DataSource dataSource) {
    final List<DataSetTable> tables;
    try {
        log.debug("List tables for catalog:{} schema:{}", catalogName, schemaName);
        tables = tableManager.listCatalogsOrTables(dataSource, catalogName, schemaName);
    } catch (final Exception e) {
        if (exceptionTransformer.causesInChain(e)) {
            throw new ThriftConnectionException(e);
        }
        if (log.isErrorEnabled()) {
            log.error("Failed to list tables for catalog [" + catalogName + "] schema [" + schemaName + "]: " + e, e);
        }
        final RestResponseStatus status = new RestResponseStatus.ResponseStatusBuilder().message(getMessage("catalog.datasource.listTables.error", catalogName, schemaName)).url(request.getRequestURI()).setDeveloperMessage(e).buildError();
        throw new InternalServerErrorException(Response.serverError().entity(status).build());
    }
    return tables;
}
Also used : DataSetTable(com.thinkbiganalytics.kylo.catalog.rest.model.DataSetTable) ThriftConnectionException(com.thinkbiganalytics.hive.exceptions.ThriftConnectionException) InternalServerErrorException(javax.ws.rs.InternalServerErrorException) TTransportException(org.apache.thrift.transport.TTransportException) BadRequestException(javax.ws.rs.BadRequestException) InternalServerErrorException(javax.ws.rs.InternalServerErrorException) NotFoundException(javax.ws.rs.NotFoundException) WebApplicationException(javax.ws.rs.WebApplicationException) AccessDeniedException(java.nio.file.AccessDeniedException) SQLException(java.sql.SQLException) ThriftConnectionException(com.thinkbiganalytics.hive.exceptions.ThriftConnectionException) CatalogException(com.thinkbiganalytics.kylo.catalog.CatalogException) PotentialControllerServiceConflictException(com.thinkbiganalytics.kylo.catalog.datasource.PotentialControllerServiceConflictException) ForbiddenException(javax.ws.rs.ForbiddenException) DataSourceAlreadyExistsException(com.thinkbiganalytics.metadata.api.catalog.DataSourceAlreadyExistsException) RestResponseStatus(com.thinkbiganalytics.rest.model.RestResponseStatus)

Aggregations

RestResponseStatus (com.thinkbiganalytics.rest.model.RestResponseStatus)11 ApiOperation (io.swagger.annotations.ApiOperation)6 ApiResponses (io.swagger.annotations.ApiResponses)6 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)6 NotFoundException (javax.ws.rs.NotFoundException)6 Path (javax.ws.rs.Path)6 AccessDeniedException (java.nio.file.AccessDeniedException)5 SQLException (java.sql.SQLException)5 BadRequestException (javax.ws.rs.BadRequestException)5 Produces (javax.ws.rs.Produces)5 WebApplicationException (javax.ws.rs.WebApplicationException)5 ThriftConnectionException (com.thinkbiganalytics.hive.exceptions.ThriftConnectionException)4 CatalogException (com.thinkbiganalytics.kylo.catalog.CatalogException)4 PotentialControllerServiceConflictException (com.thinkbiganalytics.kylo.catalog.datasource.PotentialControllerServiceConflictException)4 DataSourceAlreadyExistsException (com.thinkbiganalytics.metadata.api.catalog.DataSourceAlreadyExistsException)4 ForbiddenException (javax.ws.rs.ForbiddenException)4 GET (javax.ws.rs.GET)4 TTransportException (org.apache.thrift.transport.TTransportException)4 Response (com.jayway.restassured.response.Response)3 DataSource (com.thinkbiganalytics.kylo.catalog.rest.model.DataSource)2