当前位置: 首页>>代码示例>>Java>>正文


Java NotFoundException类代码示例

本文整理汇总了Java中org.apache.kylin.rest.exception.NotFoundException的典型用法代码示例。如果您正苦于以下问题:Java NotFoundException类的具体用法?Java NotFoundException怎么用?Java NotFoundException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotFoundException类属于org.apache.kylin.rest.exception包,在下文中一共展示了NotFoundException类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBasics

import org.apache.kylin.rest.exception.NotFoundException; //导入依赖的package包/类
@Test
public void testBasics() throws IOException {
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setRequestURI("http://localhost");

    NotFoundException notFoundException = new NotFoundException("not found");
    ErrorResponse errorResponse = basicController.handleBadRequest(request, notFoundException);
    Assert.assertNotNull(errorResponse);

    ForbiddenException forbiddenException = new ForbiddenException("forbidden");
    errorResponse = basicController.handleForbidden(request, forbiddenException);
    Assert.assertNotNull(errorResponse);

    InternalErrorException internalErrorException = new InternalErrorException("error");
    errorResponse = basicController.handleError(request, internalErrorException);
    Assert.assertNotNull(errorResponse);

    BadRequestException badRequestException = new BadRequestException("error");
    errorResponse = basicController.handleBadRequest(request, badRequestException);
    Assert.assertNotNull(errorResponse);
}
 
开发者ID:apache,项目名称:kylin,代码行数:22,代码来源:BaseControllerTest.java

示例2: deleteCube

import org.apache.kylin.rest.exception.NotFoundException; //导入依赖的package包/类
@RequestMapping(value = "/{cubeName}", method = { RequestMethod.DELETE }, produces = { "application/json" })
@ResponseBody
public void deleteCube(@PathVariable String cubeName) {
    CubeInstance cube = cubeService.getCubeManager().getCube(cubeName);
    if (null == cube) {
        throw new NotFoundException("Cube with name " + cubeName + " not found..");
    }

    //drop Cube
    try {
        cubeService.deleteCube(cube);
    } catch (Exception e) {
        logger.error(e.getLocalizedMessage(), e);
        throw new InternalErrorException("Failed to delete cube. " + " Caused by: " + e.getMessage(), e);
    }

}
 
开发者ID:apache,项目名称:kylin,代码行数:18,代码来源:CubeController.java

示例3: deleteConfig

import org.apache.kylin.rest.exception.NotFoundException; //导入依赖的package包/类
@RequestMapping(value = "/{project}/{configName}", method = { RequestMethod.DELETE }, produces = {
        "application/json" })
@ResponseBody
public void deleteConfig(@PathVariable String project, @PathVariable String configName) throws IOException {
    StreamingConfig config = streamingService.getStreamingManager().getStreamingConfig(configName);
    KafkaConfig kafkaConfig = kafkaConfigService.getKafkaConfig(configName, project);
    if (null == config) {
        throw new NotFoundException("StreamingConfig with name " + configName + " not found..");
    }
    try {
        streamingService.dropStreamingConfig(config, project);
        kafkaConfigService.dropKafkaConfig(kafkaConfig, project);
    } catch (Exception e) {
        logger.error(e.getLocalizedMessage(), e);
        throw new InternalErrorException("Failed to delete StreamingConfig. " + " Caused by: " + e.getMessage(), e);
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:18,代码来源:StreamingController.java

示例4: deleteCube

import org.apache.kylin.rest.exception.NotFoundException; //导入依赖的package包/类
@RequestMapping(value = "/{cubeName}", method = {RequestMethod.DELETE})
@ResponseBody
@Metered(name = "deleteCube")
public void deleteCube(@PathVariable String cubeName) {
    CubeInstance cube = cubeService.getCubeManager().getCube(cubeName);
    if (null == cube) {
        throw new NotFoundException("Cube with name " + cubeName + " not found..");
    }

    try {
        cubeService.deleteCube(cube);
    } catch (Exception e) {
        logger.error(e.getLocalizedMessage(), e);
        throw new InternalErrorException("Failed to delete cube. " + " Caused by: " + e.getMessage(), e);
    }
}
 
开发者ID:KylinOLAP,项目名称:Kylin,代码行数:17,代码来源:CubeController.java

示例5: deleteModel

import org.apache.kylin.rest.exception.NotFoundException; //导入依赖的package包/类
@RequestMapping(value = "/{modelName}", method = { RequestMethod.DELETE }, produces = { "application/json" })
@ResponseBody
public void deleteModel(@PathVariable String modelName) {
    DataModelDesc desc = modelService.getDataModelManager().getDataModelDesc(modelName);
    if (null == desc) {
        throw new NotFoundException("Data Model with name " + modelName + " not found..");
    }
    try {
        modelService.dropModel(desc);
    } catch (Exception e) {
        logger.error(e.getLocalizedMessage(), e);
        throw new InternalErrorException("Failed to delete model. " + " Caused by: " + e.getMessage(), e);
    }
}
 
开发者ID:apache,项目名称:kylin,代码行数:15,代码来源:ModelController.java

示例6: getTableDesc

import org.apache.kylin.rest.exception.NotFoundException; //导入依赖的package包/类
/**
 * Get available table list of the input database
 *
 * @return Table metadata array
 * @throws IOException
 */
@RequestMapping(value = "/{project}/{tableName:.+}", method = { RequestMethod.GET }, produces = { "application/json" })
@ResponseBody
public TableDesc getTableDesc(@PathVariable String tableName, @PathVariable String project) {
    TableDesc table = tableService.getTableDescByName(tableName, false, project);
    if (table == null)
        throw new NotFoundException("Could not find Hive table: " + tableName);
    return table;
}
 
开发者ID:apache,项目名称:kylin,代码行数:15,代码来源:TableController.java

示例7: handleNotFound

import org.apache.kylin.rest.exception.NotFoundException; //导入依赖的package包/类
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(NotFoundException.class)
@ResponseBody
ErrorResponse handleNotFound(HttpServletRequest req, Exception ex) {
    return new ErrorResponse(req.getRequestURL().toString(), ex);
}
 
开发者ID:apache,项目名称:kylin,代码行数:7,代码来源:BasicController.java


注:本文中的org.apache.kylin.rest.exception.NotFoundException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。