本文整理汇总了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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}