From e10c3fcd23bbe4a709bc8eb06ec6d12ec35a7718 Mon Sep 17 00:00:00 2001 From: Alex Ormenisan Date: Mon, 15 Aug 2022 15:13:24 +0200 Subject: [PATCH] [HOPSWORKS-3297] not supported exception --- .../hopsworks/api/dataset/DatasetBuilder.java | 23 ++++++----- .../api/dataset/DatasetResource.java | 21 ++++++---- .../api/dataset/inode/InodeBuilder.java | 19 +++++---- .../api/dataset/tags/DatasetTagsResource.java | 13 +++--- .../FeaturestoreKeywordResource.java | 7 ++-- .../api/featurestore/FeaturestoreService.java | 3 +- .../featureview/FeatureViewBuilder.java | 7 +++- .../featureview/FeatureViewResource.java | 11 ++--- .../tag/FeatureStoreTagResource.java | 13 +++--- .../TrainingDatasetDTOBuilder.java | 9 ++-- .../TrainingDatasetResource.java | 5 ++- .../modelregistry/ModelRegistryBuilder.java | 5 ++- .../modelregistry/ModelRegistryResource.java | 5 ++- .../ModelRegistryTagResource.java | 13 +++--- .../modelregistry/models/ModelsBuilder.java | 8 ++-- .../modelregistry/models/ModelsResource.java | 7 ++-- .../provenance/ProjectProvenanceResource.java | 8 ++-- .../api/provenance/ProvArtifactResource.java | 4 +- .../api/provenance/ops/ProvLinksBuilder.java | 3 +- .../api/provenance/ops/ProvOpsBuilder.java | 5 ++- .../api/provenance/ops/ProvUsageBuilder.java | 4 +- .../hops/hopsworks/api/tags/TagBuilder.java | 9 ++-- .../hopsworks/api/tags/TagSchemasBuilder.java | 9 ++-- .../api/tags/TagSchemasResource.java | 9 ++-- .../keyword/KeywordControllerCommunity.java | 33 +++++++++++++++ .../keyword/KeywordControllerIface.java | 34 ++++++--------- .../ops/ProvOpsControllerIface.java | 33 +++++---------- .../provenance/ops/ProvOpsControllerImpl.java | 29 +++++++++++++ .../hopsworks/common/tags/TagController.java | 28 +++++++------ .../common/tags/TagControllerIface.java | 13 +++--- .../common/tags/TagSchemasController.java | 28 +++++++------ .../tags/TagSchemasControllerIface.java | 13 +++--- .../exceptions/NotSupportedException.java | 41 +++++++++++++++++++ .../hops/hopsworks/restutils/RESTCodes.java | 35 ++++++++++++++++ 34 files changed, 332 insertions(+), 175 deletions(-) create mode 100644 hopsworks-rest-utils/src/main/java/io/hops/hopsworks/exceptions/NotSupportedException.java diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/DatasetBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/DatasetBuilder.java index f17fa2fa45..36e9081fd1 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/DatasetBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/DatasetBuilder.java @@ -31,6 +31,7 @@ import io.hops.hopsworks.common.hdfs.inode.InodeController; import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.dataset.Dataset; import io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith; @@ -116,7 +117,7 @@ public DatasetDTO expand(DatasetDTO dto, ResourceRequest resourceRequest) { private DatasetDTO build(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, String parentPath, Users dirOwner) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { expand(dto, resourceRequest); if (dto.isExpand()) { Dataset dataset = datasetPath.getDataset(); @@ -167,13 +168,13 @@ private DatasetDTO build(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resour } public DatasetDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { return build(uriInfo, resourceRequest, user, datasetPath, null, null, false); } public DatasetDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, String parentPath, Users dirOwner, boolean expandSharedWith) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { DatasetDTO dto = new DatasetDTO(); uri(dto, uriInfo); build(dto, uriInfo, resourceRequest, user, datasetPath, parentPath, dirOwner); @@ -190,7 +191,7 @@ public DatasetDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Users public DatasetDTO buildItems(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, String parentPath, Users dirOwner) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { DatasetDTO dto = new DatasetDTO(); uriItems(dto, uriInfo, datasetPath); return build(dto, uriInfo, resourceRequest, user, datasetPath, parentPath, dirOwner); @@ -206,7 +207,7 @@ public DatasetDTO buildItems(UriInfo uriInfo, ResourceRequest resourceRequest, U */ public DatasetDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Project accessProject, Users user, String name) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { Dataset dataset = datasetController.getByProjectAndDsName(accessProject, null, name); if (dataset == null) { throw new DatasetException(RESTCodes.DatasetErrorCode.DATASET_NOT_FOUND, Level.FINE); @@ -225,7 +226,7 @@ public DatasetDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Projec */ public DatasetDTO buildItems(UriInfo uriInfo, ResourceRequest resourceRequest, ResourceRequest sharedDatasetResourceRequest, Project project, Users user) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { Inode parent = project.getInode(); datasetHelper.checkResourceRequestLimit(resourceRequest, parent.getChildrenNum()); String parentPath = inodeController.getPath(parent); @@ -237,7 +238,7 @@ public DatasetDTO buildItems(UriInfo uriInfo, ResourceRequest resourceRequest, private DatasetDTO items(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, ResourceRequest sharedDatasetResourceRequest, Project accessProject, Users user, String parentPath, Users dirOwner) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { uri(dto, uriInfo); expand(dto, resourceRequest); if (dto.isExpand()) { @@ -253,7 +254,7 @@ private DatasetDTO items(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resour // datasets in the project private DatasetDTO ownItems(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, Project accessProject, Users user, String parentPath, Users dirOwner) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { AbstractFacade.CollectionInfo collectionInfo = datasetFacade.findAllDatasetByProject(null, null, resourceRequest.getFilter(), resourceRequest.getSort(), accessProject); dto.setCount(collectionInfo.getCount()); @@ -264,7 +265,7 @@ private DatasetDTO ownItems(DatasetDTO dto, UriInfo uriInfo, ResourceRequest res // shared datasets private DatasetDTO sharedItems(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, Project accessProject, Users user, String parentPath, Users dirOwner) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { AbstractFacade.CollectionInfo collectionInfo = datasetSharedWithFacade.findAllDatasetByProject(null, null, resourceRequest.getFilter(), resourceRequest.getSort(), accessProject); dto.setCount(collectionInfo.getCount()); @@ -275,7 +276,7 @@ private DatasetDTO sharedItems(DatasetDTO dto, UriInfo uriInfo, ResourceRequest // create dto from a list of dataset private DatasetDTO datasetItems(DatasetDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, List datasets, Project accessProject, Users user, String parentPath, Users dirOwner) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { if (datasets != null && !datasets.isEmpty()) { for(Dataset dataset : datasets) { DatasetPath datasetPath = datasetHelper.getTopLevelDatasetPath(accessProject, dataset); @@ -290,7 +291,7 @@ private DatasetDTO datasetSharedWithItems(DatasetDTO dto, UriInfo uriInfo, Resou Project accessProject, Users user, List datasetSharedWithList, String parentPath, Users dirOwner) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { if (datasetSharedWithList != null && !datasetSharedWithList.isEmpty()) { for(DatasetSharedWith datasetSharedWith : datasetSharedWithList) { DatasetPath datasetPath = datasetHelper.getTopLevelDatasetPath(accessProject, datasetSharedWith); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/DatasetResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/DatasetResource.java index 3e9efa1068..735b4aad1d 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/DatasetResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/DatasetResource.java @@ -42,6 +42,7 @@ import io.hops.hopsworks.exceptions.FeaturestoreException; import io.hops.hopsworks.exceptions.HopsSecurityException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProjectException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.exceptions.SchematizedTagException; @@ -56,6 +57,7 @@ import io.hops.hopsworks.restutils.RESTCodes; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.SneakyThrows; import javax.ejb.EJB; import javax.ejb.TransactionAttribute; @@ -153,7 +155,7 @@ public Response get(@BeanParam Pagination pagination, @BeanParam DatasetBeanParam datasetBeanParam, @Context HttpServletRequest req, @Context UriInfo uriInfo, @Context SecurityContext sc) - throws ProjectException, DatasetException, MetadataException, SchematizedTagException { + throws ProjectException, DatasetException, MetadataException, SchematizedTagException, NotSupportedException { Users user = jWTHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.DATASET); resourceRequest.setOffset(pagination.getOffset()); @@ -191,7 +193,7 @@ public Response getByPath(@PathParam("path") String path, @Context UriInfo uriInfo, @Context HttpServletRequest req, @Context SecurityContext sc) - throws DatasetException, ProjectException, MetadataException, SchematizedTagException { + throws DatasetException, ProjectException, MetadataException, SchematizedTagException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.INODES); resourceRequest.setExpansions(datasetExpansionBeanParam.getResources()); @@ -247,8 +249,8 @@ public Response postByPath(@Context UriInfo uriInfo, @Context SecurityContext sc @QueryParam("destination_path") String destPath, @QueryParam("destination_type") DatasetType destDatasetType, @DefaultValue("READ_ONLY") @QueryParam("permission") DatasetAccessPermission permission) - throws DatasetException, ProjectException, HopsSecurityException, ProvenanceException, MetadataException, - SchematizedTagException, FeaturestoreException { + throws DatasetException, ProjectException, HopsSecurityException, ProvenanceException, MetadataException, + SchematizedTagException, FeaturestoreException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); DatasetPath datasetPath; DatasetPath distDatasetPath; @@ -288,7 +290,8 @@ public Response postByPath(@Context UriInfo uriInfo, @Context SecurityContext sc resourceRequest = new ResourceRequest(ResourceRequest.Name.INODES); Inode inode = inodeController.getInodeAtPath(datasetPath.getFullPath().toString()); datasetPath.setInode(inode); - InodeDTO dto = inodeBuilder.buildStat(uriInfo, resourceRequest, user, datasetPath, inode); + InodeDTO dto; + dto = inodeBuilder.buildStat(uriInfo, resourceRequest, user, datasetPath, inode); return Response.created(dto.getHref()).entity(dto).build(); } case COPY: @@ -364,6 +367,7 @@ public Response postByPath(@Context UriInfo uriInfo, @Context SecurityContext sc return Response.noContent().build(); } + @SneakyThrows @PUT @Path("{path: .+}") @Produces(MediaType.APPLICATION_JSON) @@ -379,8 +383,7 @@ public Response update(@PathParam("path") String path, @QueryParam("type") Datas @DefaultValue("READ_ONLY") @QueryParam("permissions") DatasetAccessPermission datasetPermissions, @QueryParam("target_project") String targetProjectName, @Context UriInfo uriInfo, - @Context SecurityContext sc) - throws DatasetException, ProjectException, MetadataException, SchematizedTagException, FeaturestoreException { + @Context SecurityContext sc) { Project project = this.getProject(); DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, datasetType); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.DATASET); @@ -394,8 +397,8 @@ public Response update(@PathParam("path") String path, @QueryParam("type") Datas break; case SHARE_PERMISSION: checkIfDataOwner(project, user); - datasetController.updateSharePermission(datasetPath.getDataset(), datasetPermissions, project, targetProjectName - , user); + datasetController.updateSharePermission(datasetPath.getDataset(), datasetPermissions, project, + targetProjectName, user); dto = datasetBuilder.build(uriInfo, resourceRequest, user, datasetPath, null, null, false); break; case DESCRIPTION: diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/inode/InodeBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/inode/InodeBuilder.java index 2bb8f388cb..38ddb47404 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/inode/InodeBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/inode/InodeBuilder.java @@ -31,6 +31,7 @@ import io.hops.hopsworks.common.util.Settings; import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.hdfs.inode.Inode; import io.hops.hopsworks.persistence.entity.project.Project; @@ -101,7 +102,7 @@ private InodeDTO expand(InodeDTO dto, ResourceRequest resourceRequest) { public InodeDTO buildStat(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, Inode inode, Users dirOwner) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { InodeDTO dto = new InodeDTO(); uri(dto, uriInfo, inode); expand(dto, resourceRequest); @@ -130,7 +131,7 @@ public InodeDTO buildResource(UriInfo uriInfo, Project project, DatasetPath data */ public InodeDTO buildStat(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, Inode inode) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { InodeDTO dto = new InodeDTO(); uri(dto, uriInfo); expand(dto, resourceRequest); @@ -144,7 +145,7 @@ public InodeDTO buildStat(UriInfo uriInfo, ResourceRequest resourceRequest, User public InodeDTO buildBlob(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, Inode inode, FilePreviewMode mode) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { InodeDTO dto = new InodeDTO(); uri(dto, uriInfo); expand(dto, resourceRequest); @@ -168,7 +169,7 @@ public InodeDTO buildBlob(UriInfo uriInfo, ResourceRequest resourceRequest, User * @return */ public InodeDTO buildStat(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { Inode inode = datasetPath.getInode(); if (inode == null) { throw new DatasetException(RESTCodes.DatasetErrorCode.PATH_NOT_FOUND, Level.FINE); @@ -187,7 +188,7 @@ public InodeDTO buildStat(UriInfo uriInfo, ResourceRequest resourceRequest, User */ public InodeDTO buildBlob(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, FilePreviewMode mode) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { Inode inode = datasetPath.getInode(); if (inode == null) { throw new DatasetException(RESTCodes.DatasetErrorCode.PATH_NOT_FOUND, Level.FINE); @@ -206,7 +207,7 @@ public InodeDTO buildBlob(UriInfo uriInfo, ResourceRequest resourceRequest, User * @return */ public InodeDTO buildItems(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { Inode parent = datasetPath.getInode(); if (parent == null) { throw new DatasetException(RESTCodes.DatasetErrorCode.PATH_NOT_FOUND, Level.FINE); @@ -219,7 +220,7 @@ public InodeDTO buildItems(UriInfo uriInfo, ResourceRequest resourceRequest, Use private InodeDTO build(UriInfo uriInfo, InodeDTO dto, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, Inode parent) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { uri(dto, uriInfo); Users dirOwner = userFacade.findByUsername(parent.getHdfsUser().getUsername()); datasetHelper.checkResourceRequestLimit(resourceRequest, parent.getChildrenNum()); @@ -229,7 +230,7 @@ private InodeDTO build(UriInfo uriInfo, InodeDTO dto, ResourceRequest resourceRe private InodeDTO items(UriInfo uriInfo, InodeDTO dto, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, Inode parent, Users dirOwner) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { expand(dto, resourceRequest); AbstractFacade.CollectionInfo collectionInfo; if (dto.isExpand()) { @@ -243,7 +244,7 @@ private InodeDTO items(UriInfo uriInfo, InodeDTO dto, ResourceRequest resourceRe private InodeDTO items(UriInfo uriInfo, InodeDTO dto, ResourceRequest resourceRequest, Users user, DatasetPath datasetPath, List inodes, Users dirOwner) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { if (inodes != null && !inodes.isEmpty()) { for(Inode inode : inodes) { dto.addItem(buildStat(uriInfo, resourceRequest, user, datasetPath, inode, dirOwner)); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/tags/DatasetTagsResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/tags/DatasetTagsResource.java index a612ed686d..3768eea7a5 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/tags/DatasetTagsResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/dataset/tags/DatasetTagsResource.java @@ -28,6 +28,7 @@ import io.hops.hopsworks.common.dataset.util.DatasetPath; import io.hops.hopsworks.common.tags.AttachTagResult; import io.hops.hopsworks.exceptions.DatasetException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.exceptions.MetadataException; import io.hops.hopsworks.jwt.annotation.JWTRequired; @@ -102,7 +103,7 @@ public Response putTag(@Context SecurityContext sc, @Context UriInfo uriInfo, @PathParam("path") String path, @QueryParam("datasetType") DatasetType datasetType, @ApiParam(value = "Value to set for the tag") String value) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, datasetType); Users user = jWTHelper.getUserPrincipal(sc); @@ -130,7 +131,7 @@ public Response bulkPutTags(@Context SecurityContext sc, @Context UriInfo uriInf @PathParam("path") String path, @QueryParam("datasetType") DatasetType datasetType, TagsDTO tags) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, datasetType); Users user = jWTHelper.getUserPrincipal(sc); @@ -170,7 +171,7 @@ public Response getTags(@Context SecurityContext sc, @Context UriInfo uriInfo, @PathParam("path") String path, @QueryParam("datasetType") DatasetType datasetType, @BeanParam TagsExpansionBeanParam tagsExpansionBeanParam) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, datasetType); Users user = jWTHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.TAGS); @@ -195,7 +196,7 @@ public Response getTag(@Context SecurityContext sc, @Context UriInfo uriInfo, @PathParam("path") String path, @QueryParam("datasetType") DatasetType datasetType, @BeanParam TagsExpansionBeanParam tagsExpansionBeanParam) - throws DatasetException, SchematizedTagException, MetadataException { + throws DatasetException, SchematizedTagException, MetadataException, NotSupportedException { DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, datasetType); Users user = jWTHelper.getUserPrincipal(sc); @@ -218,7 +219,7 @@ public Response deleteTags(@Context SecurityContext sc, @Context HttpServletRequest req, @PathParam("path") String path, @QueryParam("datasetType") DatasetType datasetType) - throws DatasetException, MetadataException { + throws DatasetException, MetadataException, NotSupportedException { DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, datasetType); Users user = jWTHelper.getUserPrincipal(sc); @@ -242,7 +243,7 @@ public Response deleteTag(@Context SecurityContext sc, @PathParam("schemaName") String schemaName, @PathParam("path") String path, @QueryParam("datasetType") DatasetType datasetType) - throws DatasetException, MetadataException { + throws DatasetException, MetadataException, NotSupportedException { DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, datasetType); Users user = jWTHelper.getUserPrincipal(sc); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/FeaturestoreKeywordResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/FeaturestoreKeywordResource.java index fe6133635b..36bbb9e2b5 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/FeaturestoreKeywordResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/FeaturestoreKeywordResource.java @@ -28,6 +28,7 @@ import io.hops.hopsworks.common.featurestore.trainingdatasets.TrainingDatasetController; import io.hops.hopsworks.exceptions.FeaturestoreException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.jwt.annotation.JWTRequired; import io.hops.hopsworks.persistence.entity.featurestore.Featurestore; import io.hops.hopsworks.persistence.entity.featurestore.featuregroup.Featuregroup; @@ -116,7 +117,7 @@ public void setFeatureView(String name, Integer version) throws FeaturestoreExce public Response getKeywords(@Context SecurityContext sc, @Context HttpServletRequest req, @Context UriInfo uriInfo) - throws FeaturestoreException, MetadataException { + throws FeaturestoreException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS); @@ -147,7 +148,7 @@ public Response getKeywords(@Context SecurityContext sc, public Response replaceKeywords(@Context SecurityContext sc, @Context HttpServletRequest req, @Context UriInfo uriInfo, KeywordDTO keywordDTO) - throws FeaturestoreException, MetadataException { + throws FeaturestoreException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS); @@ -178,7 +179,7 @@ public Response deleteKeywords(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, @QueryParam("keyword") String keyword) - throws FeaturestoreException, MetadataException { + throws FeaturestoreException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/FeaturestoreService.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/FeaturestoreService.java index 28ccffa1b7..d2eca4e81c 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/FeaturestoreService.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/FeaturestoreService.java @@ -36,6 +36,7 @@ import io.hops.hopsworks.common.featurestore.settings.FeaturestoreClientSettingsDTO; import io.hops.hopsworks.common.util.Settings; import io.hops.hopsworks.exceptions.FeaturestoreException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.jwt.annotation.JWTRequired; import io.hops.hopsworks.persistence.entity.project.Project; import io.hops.hopsworks.persistence.entity.user.security.apiKey.ApiScope; @@ -297,7 +298,7 @@ public FsQueryConstructorResource constructQuery() { @ApiOperation(value = "Get available keywords for the featurestore", response = KeywordDTO.class) public Response getUsedKeywords(@Context SecurityContext sc, @Context HttpServletRequest req, - @Context UriInfo uriInfo) throws FeaturestoreException { + @Context UriInfo uriInfo) throws FeaturestoreException, NotSupportedException { List keywords = keywordControllerIface.getUsedKeywords(); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.KEYWORDS); KeywordDTO dto = featurestoreKeywordBuilder.build(uriInfo, resourceRequest, project, keywords); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/featureview/FeatureViewBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/featureview/FeatureViewBuilder.java index c3fa27348b..e27be8d015 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/featureview/FeatureViewBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/featureview/FeatureViewBuilder.java @@ -40,6 +40,7 @@ import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.FeaturestoreException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.exceptions.ServiceException; import io.hops.hopsworks.persistence.entity.dataset.DatasetType; @@ -127,7 +128,8 @@ private void setQuery(Project project, Users user, QueryDTO queryDTO, FeatureVie public FeatureViewDTO build(List featureViews, ResourceRequest resourceRequest, Project project, Users user, UriInfo uriInfo) - throws FeaturestoreException, ServiceException, MetadataException, DatasetException, SchematizedTagException { + throws FeaturestoreException, ServiceException, MetadataException, DatasetException, SchematizedTagException, + NotSupportedException { FeatureViewDTO featureViewDTO = new FeatureViewDTO(); featureViewDTO.setHref(uriInfo.getRequestUri()); @@ -147,7 +149,8 @@ public FeatureViewDTO build(List featureViews, ResourceRequest reso public FeatureViewDTO build(FeatureView featureView, ResourceRequest resourceRequest, Project project, Users user, UriInfo uriInfo) - throws FeaturestoreException, ServiceException, MetadataException, DatasetException, SchematizedTagException { + throws FeaturestoreException, ServiceException, MetadataException, DatasetException, SchematizedTagException, + NotSupportedException { FeatureViewDTO base = convertToDTO(featureView); if (resourceRequest != null) { if (resourceRequest.contains(ResourceRequest.Name.QUERY_STRING)) { diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/featureview/FeatureViewResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/featureview/FeatureViewResource.java index 06f7393e50..9736fadefb 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/featureview/FeatureViewResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/featureview/FeatureViewResource.java @@ -27,6 +27,7 @@ import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.FeaturestoreException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.exceptions.ServiceException; @@ -99,7 +100,7 @@ public Response create( @Context UriInfo uriInfo, FeatureViewDTO featureViewDTO) throws FeaturestoreException, ProvenanceException, ServiceException, IOException, - SchematizedTagException, MetadataException, DatasetException { + SchematizedTagException, MetadataException, DatasetException, NotSupportedException { if (featureViewDTO == null) { throw new IllegalArgumentException("Input JSON for creating a new Feature View cannot be null"); } @@ -136,7 +137,7 @@ public Response getAll( @BeanParam FeatureViewBeanParam param ) throws FeaturestoreException, ServiceException, MetadataException, DatasetException, - SchematizedTagException { + SchematizedTagException, NotSupportedException { Users user = jWTHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = makeResourceRequest(param); List featureViews = featureViewController.getByFeatureStore(featurestore, @@ -169,7 +170,7 @@ public Response getByName( @PathParam("name") String name ) throws FeaturestoreException, ServiceException, MetadataException, DatasetException, - SchematizedTagException { + SchematizedTagException, NotSupportedException { Users user = jWTHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = makeResourceRequest(param); List featureViews = featureViewController.getByNameAndFeatureStore(name, featurestore, @@ -205,7 +206,7 @@ public Response getByNameVersion( @PathParam("version") Integer version ) throws FeaturestoreException, ServiceException, MetadataException, DatasetException, - SchematizedTagException { + SchematizedTagException, NotSupportedException { Users user = jWTHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = makeResourceRequest(param); FeatureView featureView = featureViewController.getByNameVersionAndFeatureStore(name, version, featurestore); @@ -290,7 +291,7 @@ public Response update( @PathParam("version") Integer version, FeatureViewDTO featureViewDTO) throws FeaturestoreException, ServiceException, - SchematizedTagException, MetadataException, DatasetException { + SchematizedTagException, MetadataException, DatasetException, NotSupportedException { if (featureViewDTO == null) { throw new IllegalArgumentException("Input JSON for updating a Feature View cannot be null"); } diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/tag/FeatureStoreTagResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/tag/FeatureStoreTagResource.java index f7312e8e3c..7ce0585823 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/tag/FeatureStoreTagResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/tag/FeatureStoreTagResource.java @@ -29,6 +29,7 @@ import io.hops.hopsworks.common.tags.TagsDTO; import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.jwt.annotation.JWTRequired; import io.hops.hopsworks.persistence.entity.featurestore.Featurestore; @@ -112,7 +113,7 @@ public Response putTag(@Context SecurityContext sc, @Context UriInfo uriInfo, @ApiParam(value = "Name of the tag", required = true) @PathParam("name") String name, @ApiParam(value = "Value to set for the tag") String value) - throws MetadataException, SchematizedTagException, DatasetException { + throws MetadataException, SchematizedTagException, DatasetException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); AttachTagResult result = tagController.upsert(user, getDatasetPath(), name, value); @@ -139,7 +140,7 @@ public Response putTag(@Context SecurityContext sc, public Response bulkPutTags(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, TagsDTO tags) - throws MetadataException, SchematizedTagException, DatasetException { + throws MetadataException, SchematizedTagException, DatasetException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); AttachTagResult result; @@ -175,7 +176,7 @@ private Map tagsToMap(TagsDTO tags) { public Response getTags(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, @BeanParam TagsExpansionBeanParam tagsExpansionBeanParam) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.TAGS); @@ -198,7 +199,7 @@ public Response getTag(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, @ApiParam(value = "Name of the tag", required = true) @PathParam("name") String name, @BeanParam TagsExpansionBeanParam tagsExpansionBeanParam) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.TAGS); @@ -218,7 +219,7 @@ public Response getTag(@Context SecurityContext sc, @Context UriInfo uriInfo, allowedUserRoles = {"HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_USER"}) public Response deleteTags(@Context SecurityContext sc, @Context HttpServletRequest req) - throws DatasetException, MetadataException { + throws DatasetException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); tagController.deleteAll(user, getDatasetPath()); @@ -237,7 +238,7 @@ public Response deleteTags(@Context SecurityContext sc, public Response deleteTag(@Context SecurityContext sc, @Context HttpServletRequest req, @ApiParam(value = "Name of the tag", required = true) @PathParam("name") String name) - throws DatasetException, MetadataException { + throws DatasetException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); tagController.delete(user, getDatasetPath(), name); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/trainingdataset/TrainingDatasetDTOBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/trainingdataset/TrainingDatasetDTOBuilder.java index a60f50c934..09e1c100e7 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/trainingdataset/TrainingDatasetDTOBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/trainingdataset/TrainingDatasetDTOBuilder.java @@ -29,6 +29,7 @@ import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.FeaturestoreException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.exceptions.ServiceException; import io.hops.hopsworks.persistence.entity.dataset.DatasetType; @@ -63,8 +64,8 @@ public class TrainingDatasetDTOBuilder { public TrainingDatasetDTO build(Users user, Project project, TrainingDataset trainingDataset, UriInfo uriInfo,ResourceRequest resourceRequest) throws - FeaturestoreException, ServiceException, SchematizedTagException, MetadataException, DatasetException, - IOException { + FeaturestoreException, ServiceException, SchematizedTagException, MetadataException, DatasetException, + IOException, NotSupportedException { TrainingDatasetDTO trainingDatasetDTO = trainingDatasetController.convertTrainingDatasetToDTO(user, project, trainingDataset, true); if (resourceRequest != null) { @@ -93,8 +94,8 @@ public TrainingDatasetDTO build(Users user, Project project, TrainingDataset tra public TrainingDatasetDTO build(Users user, Project project, List trainingDatasets, UriInfo uriInfo, ResourceRequest resourceRequest) - throws FeaturestoreException, ServiceException, SchematizedTagException, MetadataException, DatasetException, - IOException { + throws FeaturestoreException, ServiceException, SchematizedTagException, MetadataException, DatasetException, + IOException, NotSupportedException { TrainingDatasetDTO trainingDatasetDTO = new TrainingDatasetDTO(); trainingDatasetDTO.setCount((long) trainingDatasets.size()); trainingDatasetDTO.setHref(uriInfo.getRequestUri()); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/trainingdataset/TrainingDatasetResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/trainingdataset/TrainingDatasetResource.java index 99ad971b4c..9c058935f2 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/trainingdataset/TrainingDatasetResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/featurestore/trainingdataset/TrainingDatasetResource.java @@ -34,6 +34,7 @@ import io.hops.hopsworks.exceptions.GenericException; import io.hops.hopsworks.exceptions.JobException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProjectException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.exceptions.SchematizedTagException; @@ -146,7 +147,7 @@ public Response getAll( @BeanParam TrainingDatasetExpansionBeanParam param ) throws FeaturestoreException, ServiceException, MetadataException, DatasetException, SchematizedTagException, - IOException { + IOException, NotSupportedException { Users user = jWTHelper.getUserPrincipal(sc); List trainingDatasets = trainingDatasetController.getTrainingDatasetByFeatureView(featureView); @@ -178,7 +179,7 @@ public Response getByVersion( @PathParam("version") Integer version ) throws FeaturestoreException, ServiceException, MetadataException, DatasetException, SchematizedTagException, - IOException { + IOException, NotSupportedException { Users user = jWTHelper.getUserPrincipal(sc); TrainingDataset trainingDataset = trainingDatasetController.getTrainingDatasetByFeatureViewAndVersion(featureView, version); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryBuilder.java index b2c16bb61f..8f2f878d8c 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryBuilder.java @@ -22,6 +22,7 @@ import io.hops.hopsworks.exceptions.GenericException; import io.hops.hopsworks.exceptions.MetadataException; import io.hops.hopsworks.exceptions.ModelRegistryException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.dataset.Dataset; import io.hops.hopsworks.persistence.entity.dataset.DatasetSharedWith; @@ -69,7 +70,7 @@ public ModelRegistryDTO expand(ModelRegistryDTO dto, ResourceRequest resourceReq //Build collection public ModelRegistryDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, Project project) - throws GenericException, ModelRegistryException, SchematizedTagException, MetadataException { + throws GenericException, ModelRegistryException, SchematizedTagException, MetadataException, NotSupportedException { ModelRegistryDTO dto = new ModelRegistryDTO(); uri(dto, uriInfo, project); expand(dto, resourceRequest); @@ -99,7 +100,7 @@ public ModelRegistryDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, //Build specific public ModelRegistryDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, Users user, Project userProject, Project modelRegistryProject) throws GenericException, ModelRegistryException, - SchematizedTagException, MetadataException { + SchematizedTagException, MetadataException, NotSupportedException { ModelRegistryDTO dto = new ModelRegistryDTO(); uri(dto, uriInfo, userProject, modelRegistryProject); expand(dto, resourceRequest); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryResource.java index 9f2662e5f8..ebf927f0a0 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryResource.java @@ -30,6 +30,7 @@ import io.hops.hopsworks.exceptions.GenericException; import io.hops.hopsworks.exceptions.MetadataException; import io.hops.hopsworks.exceptions.ModelRegistryException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.jwt.annotation.JWTRequired; import io.hops.hopsworks.persistence.entity.project.Project; @@ -89,7 +90,7 @@ public Response getAll( @BeanParam Pagination pagination, @Context UriInfo uriInfo, @Context SecurityContext sc) throws GenericException, ModelRegistryException, SchematizedTagException, - MetadataException { + MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.MODELREGISTRIES); resourceRequest.setExpansions(modelRegistryBeanParam.getExpansions().getResources()); @@ -114,7 +115,7 @@ public Response get ( @BeanParam Pagination pagination, @Context UriInfo uriInfo, @Context SecurityContext sc) throws GenericException, ModelRegistryException, SchematizedTagException, - MetadataException { + MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.MODELREGISTRIES); resourceRequest.setExpansions(modelRegistryBeanParam.getExpansions().getResources()); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryTagResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryTagResource.java index 2533a6fcec..4c48121444 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryTagResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/ModelRegistryTagResource.java @@ -29,6 +29,7 @@ import io.hops.hopsworks.common.tags.TagsDTO; import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.jwt.annotation.JWTRequired; import io.hops.hopsworks.persistence.entity.project.Project; @@ -111,7 +112,7 @@ public Response putTag(@Context SecurityContext sc, @Context UriInfo uriInfo, @ApiParam(value = "Name of the tag", required = true) @PathParam("name") String name, @ApiParam(value = "Value to set for the tag") String value) - throws MetadataException, SchematizedTagException, DatasetException { + throws MetadataException, SchematizedTagException, DatasetException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); AttachTagResult result = tagController.upsert(user, getDatasetPath(), name, value); @@ -138,7 +139,7 @@ public Response putTag(@Context SecurityContext sc, public Response bulkPutTags(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, TagsDTO tags) - throws MetadataException, SchematizedTagException, DatasetException { + throws MetadataException, SchematizedTagException, DatasetException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); AttachTagResult result; @@ -174,7 +175,7 @@ public Response bulkPutTags(@Context SecurityContext sc, @Context UriInfo uriInf public Response getTags(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, @BeanParam TagsExpansionBeanParam tagsExpansionBeanParam) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.TAGS); @@ -197,7 +198,7 @@ public Response getTag(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, @ApiParam(value = "Name of the tag", required = true) @PathParam("name") String name, @BeanParam TagsExpansionBeanParam tagsExpansionBeanParam) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.TAGS); @@ -217,7 +218,7 @@ public Response getTag(@Context SecurityContext sc, @Context UriInfo uriInfo, allowedUserRoles = {"HOPS_ADMIN", "HOPS_USER", "HOPS_SERVICE_USER"}) public Response deleteTags(@Context SecurityContext sc, @Context HttpServletRequest req) - throws DatasetException, MetadataException { + throws DatasetException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); tagController.deleteAll(user, getDatasetPath()); @@ -236,7 +237,7 @@ public Response deleteTags(@Context SecurityContext sc, public Response deleteTag(@Context SecurityContext sc, @Context HttpServletRequest req, @ApiParam(value = "Name of the tag", required = true) @PathParam("name") String name) - throws DatasetException, MetadataException { + throws DatasetException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); tagController.delete(user, getDatasetPath(), name); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/models/ModelsBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/models/ModelsBuilder.java index 0a81f3dfdc..df3b6cc398 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/models/ModelsBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/models/ModelsBuilder.java @@ -30,7 +30,6 @@ import io.hops.hopsworks.common.dataset.FilePreviewMode; import io.hops.hopsworks.common.dataset.util.DatasetHelper; import io.hops.hopsworks.common.dataset.util.DatasetPath; -import io.hops.hopsworks.common.featurestore.FeaturestoreFacade; import io.hops.hopsworks.common.hdfs.HdfsUsersController; import io.hops.hopsworks.common.provenance.core.Provenance; import io.hops.hopsworks.common.provenance.state.ProvStateParamBuilder; @@ -43,6 +42,7 @@ import io.hops.hopsworks.exceptions.GenericException; import io.hops.hopsworks.exceptions.MetadataException; import io.hops.hopsworks.exceptions.ModelRegistryException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.dataset.DatasetType; @@ -88,8 +88,6 @@ public class ModelsBuilder { @EJB private ProjectTeamFacade projectTeamFacade; @EJB - private FeaturestoreFacade featurestoreFacade; - @EJB private ModelsController modelsController; @EJB private InodeBuilder inodeBuilder; @@ -138,7 +136,7 @@ public ModelDTO build(UriInfo uriInfo, Project userProject, Project modelRegistryProject ) - throws ModelRegistryException, GenericException, SchematizedTagException, MetadataException { + throws ModelRegistryException, GenericException, SchematizedTagException, MetadataException, NotSupportedException { ModelDTO dto = new ModelDTO(); uri(dto, uriInfo, userProject, modelRegistryProject); expand(dto, resourceRequest); @@ -194,7 +192,7 @@ public ModelDTO build(UriInfo uriInfo, Project modelRegistryProject, ProvStateDTO fileProvenanceHit, String modelsFolder) throws DatasetException, ModelRegistryException, SchematizedTagException, - MetadataException { + MetadataException, NotSupportedException { ModelDTO modelDTO = new ModelDTO(); uri(modelDTO, uriInfo, userProject, modelRegistryProject, fileProvenanceHit); if (expand(modelDTO, resourceRequest).isExpand()) { diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/models/ModelsResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/models/ModelsResource.java index a2948e84b9..909c5fc67d 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/models/ModelsResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/modelregistry/models/ModelsResource.java @@ -32,6 +32,7 @@ import io.hops.hopsworks.exceptions.KafkaException; import io.hops.hopsworks.exceptions.MetadataException; import io.hops.hopsworks.exceptions.ModelRegistryException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProjectException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.exceptions.PythonException; @@ -122,7 +123,7 @@ public Response getAll( @BeanParam ModelsBeanParam modelsBeanParam, @Context UriInfo uriInfo, @Context SecurityContext sc) - throws ModelRegistryException, GenericException, SchematizedTagException, MetadataException { + throws ModelRegistryException, GenericException, SchematizedTagException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.MODELS); resourceRequest.setOffset(pagination.getOffset()); @@ -148,8 +149,8 @@ public Response get ( @BeanParam ModelsBeanParam modelsBeanParam, @Context UriInfo uriInfo, @Context SecurityContext sc) - throws ProvenanceException, ModelRegistryException, DatasetException, GenericException, - SchematizedTagException, MetadataException { + throws ProvenanceException, ModelRegistryException, DatasetException, GenericException, + SchematizedTagException, MetadataException, NotSupportedException { Users user = jwtHelper.getUserPrincipal(sc); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.MODELS); resourceRequest.setExpansions(modelsBeanParam.getExpansions().getResources()); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ProjectProvenanceResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ProjectProvenanceResource.java index 22ee1d8aa3..7952844cb1 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ProjectProvenanceResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ProjectProvenanceResource.java @@ -46,6 +46,7 @@ import io.hops.hopsworks.exceptions.FeaturestoreException; import io.hops.hopsworks.exceptions.GenericException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.jwt.annotation.JWTRequired; @@ -177,7 +178,7 @@ public Response getFileOps( @BeanParam Pagination pagination, @Context HttpServletRequest req, @Context SecurityContext sc, - @Context UriInfo uriInfo) throws ProvenanceException, GenericException { + @Context UriInfo uriInfo) throws ProvenanceException, GenericException, NotSupportedException { ProvOpsDTO result = opsBuilder.build(project, params, pagination); return Response.ok().entity(result).build(); } @@ -195,7 +196,7 @@ public Response getFileOps( public Response getLinks( @BeanParam ProvLinksBeanParams params, @BeanParam Pagination pagination, - @Context HttpServletRequest req) throws ProvenanceException, GenericException { + @Context HttpServletRequest req) throws ProvenanceException, GenericException, NotSupportedException { ProvLinksDTO result = linksBuilder.build(project, params, pagination); return Response.ok().entity(result).build(); } @@ -215,7 +216,8 @@ public Response usage( @BeanParam ProvUsageBeanParams params, @Context UriInfo uriInfo, @Context SecurityContext sc) - throws ProvenanceException, GenericException, DatasetException, MetadataException, SchematizedTagException { + throws ProvenanceException, GenericException, DatasetException, MetadataException, SchematizedTagException, + NotSupportedException { Users user = jWTHelper.getUserPrincipal(sc); if(artifactId == null) { throw new GenericException(RESTCodes.GenericErrorCode.ILLEGAL_ARGUMENT, Level.FINE, diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ProvArtifactResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ProvArtifactResource.java index 17a39cd106..734107e134 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ProvArtifactResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ProvArtifactResource.java @@ -25,6 +25,7 @@ import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.GenericException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.jwt.annotation.JWTRequired; @@ -79,7 +80,8 @@ public Response status( @BeanParam ProvUsageBeanParams params, @Context UriInfo uriInfo, @Context SecurityContext sc) - throws ProvenanceException, GenericException, DatasetException, MetadataException, SchematizedTagException { + throws ProvenanceException, GenericException, DatasetException, MetadataException, SchematizedTagException, + NotSupportedException { Users user = jWTHelper.getUserPrincipal(sc); ProvArtifactUsageParentDTO status = usageBuilder.buildAccessible(uriInfo, user, targetEndpoint, artifactId, params.getUsageType()); diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvLinksBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvLinksBuilder.java index 89f7c1c80a..d3d5ebeb0e 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvLinksBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvLinksBuilder.java @@ -20,6 +20,7 @@ import io.hops.hopsworks.common.provenance.ops.ProvOpsControllerIface; import io.hops.hopsworks.common.provenance.ops.dto.ProvLinksDTO; import io.hops.hopsworks.exceptions.GenericException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.persistence.entity.project.Project; @@ -35,7 +36,7 @@ public class ProvLinksBuilder { private ProvOpsControllerIface opsProvCtrl; public ProvLinksDTO build(Project project, ProvLinksBeanParams opsParams, PaginationParams pagParams) - throws ProvenanceException, GenericException { + throws ProvenanceException, GenericException, NotSupportedException { ProvLinksParamBuilder paramBuilder = new ProvLinksParamBuilder() .onlyApps(opsParams.isOnlyApps()) .linkType(opsParams.isFullLink()) diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvOpsBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvOpsBuilder.java index 4714c7f9ab..3d0db31706 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvOpsBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvOpsBuilder.java @@ -21,6 +21,7 @@ import io.hops.hopsworks.common.provenance.ops.ProvOpsReturnType; import io.hops.hopsworks.common.provenance.ops.dto.ProvOpsDTO; import io.hops.hopsworks.exceptions.GenericException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.persistence.entity.project.Project; import io.hops.hopsworks.restutils.RESTCodes; @@ -38,7 +39,7 @@ public class ProvOpsBuilder { private ProvOpsControllerIface opsProvCtrl; public ProvOpsDTO build(Project project, ProvOpsBeanParams opsParams, PaginationParams pagParams) - throws ProvenanceException, GenericException { + throws ProvenanceException, GenericException, NotSupportedException { ProvOpsParamBuilder params = new ProvOpsParamBuilder() .filterByFields(opsParams.getFileOpsFilterBy()) .sortByFields(opsParams.getFileOpsSortBy()) @@ -50,7 +51,7 @@ public ProvOpsDTO build(Project project, ProvOpsBeanParams opsParams, Pagination } public ProvOpsDTO build(Project project, ProvOpsParamBuilder params, ProvOpsReturnType returnType) - throws ProvenanceException, GenericException { + throws ProvenanceException, GenericException, NotSupportedException { ProvOpsDTO result; switch(returnType){ case LIST: diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvUsageBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvUsageBuilder.java index a3f71a3387..bd04cb2e57 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvUsageBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/provenance/ops/ProvUsageBuilder.java @@ -42,6 +42,7 @@ import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.GenericException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.dataset.Dataset; @@ -87,7 +88,8 @@ public class ProvUsageBuilder { public ProvArtifactUsageParentDTO buildAccessible(UriInfo uriInfo, Users user, DatasetPath targetEndpoint, String artifactId, Set type) - throws ProvenanceException, GenericException, DatasetException, MetadataException, SchematizedTagException { + throws ProvenanceException, GenericException, DatasetException, MetadataException, SchematizedTagException, + NotSupportedException { if(!accessController.hasAccess(targetEndpoint.getAccessProject(), targetEndpoint.getDataset())) { throw new GenericException(RESTCodes.GenericErrorCode.NOT_AUTHORIZED_TO_ACCESS, Level.FINE); } diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagBuilder.java index 161027e527..8dadb56858 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagBuilder.java @@ -21,6 +21,7 @@ import io.hops.hopsworks.common.tags.TagsDTO; import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.user.Users; @@ -40,7 +41,7 @@ public class TagBuilder { private TagSchemasBuilder tagSchemasBuilder; public TagsDTO build(TagUri tagUri, ResourceRequest resourceRequest, Users user, DatasetPath path) - throws DatasetException, MetadataException, SchematizedTagException { + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException { TagsDTO dto = tagUri.addUri(new TagsDTO(), path); if (resourceRequest != null && resourceRequest.contains(ResourceRequest.Name.TAGS)) { Map tags = tagController.getAll(user, path); @@ -58,7 +59,7 @@ public TagsDTO build(TagUri tagUri, ResourceRequest resourceRequest, Users user, public TagsDTO build(TagUri tagUri, ResourceRequest resourceRequest, Users user, DatasetPath path, String name) - throws SchematizedTagException, DatasetException, MetadataException { + throws SchematizedTagException, DatasetException, MetadataException, NotSupportedException { TagsDTO dto = tagUri.addUri(new TagsDTO(), path, name); if (resourceRequest != null && resourceRequest.contains(ResourceRequest.Name.TAGS)) { String value = tagController.get(user, path, name); @@ -72,7 +73,7 @@ public TagsDTO build(TagUri tagUri, ResourceRequest resourceRequest, Users user, @Deprecated public TagsDTO buildAsMap(TagUri tagUri, ResourceRequest resourceRequest, Users user, DatasetPath path, String name) - throws SchematizedTagException, DatasetException, MetadataException { + throws SchematizedTagException, DatasetException, MetadataException, NotSupportedException { TagsDTO dto = tagUri.addUri(new TagsDTO(), path, name); if (resourceRequest != null && resourceRequest.contains(ResourceRequest.Name.TAGS)) { TagsDTO item = tagUri.addUri(new TagsDTO(), path, name); @@ -104,7 +105,7 @@ public TagsDTO build(TagUri tagUri, DatasetPath path, Map tags) private TagsDTO buildFull(TagsDTO dto, TagUri tagUri, ResourceRequest resourceRequest, String name, String value) - throws SchematizedTagException { + throws SchematizedTagException, NotSupportedException { buildBase(dto, name, value); dto.setSchema(tagSchemasBuilder.build(tagUri.getUriInfo(), resourceRequest, name)); return dto; diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagSchemasBuilder.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagSchemasBuilder.java index e0843daa79..e4ac645fb2 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagSchemasBuilder.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagSchemasBuilder.java @@ -21,6 +21,7 @@ import io.hops.hopsworks.common.dao.featurestore.tag.TagSchemasFacade; import io.hops.hopsworks.common.tags.SchemaDTO; import io.hops.hopsworks.common.tags.TagSchemasControllerIface; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.featurestore.tag.TagSchemas; import io.hops.hopsworks.restutils.RESTCodes; @@ -58,7 +59,7 @@ public SchemaDTO uriItems(SchemaDTO dto, UriInfo uriInfo, TagSchemas tag) { } public SchemaDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, String value) - throws SchematizedTagException { + throws SchematizedTagException, NotSupportedException { TagSchemas tag = tagSchemasFacade.findByName(value); if(tag == null) { throw new SchematizedTagException(RESTCodes.SchematizedTagErrorCode.TAG_SCHEMA_NOT_FOUND, Level.FINE); @@ -68,7 +69,7 @@ public SchemaDTO build(UriInfo uriInfo, ResourceRequest resourceRequest, String } public SchemaDTO build(UriInfo uriInfo, ResourceRequest resourceRequest) - throws SchematizedTagException { + throws SchematizedTagException, NotSupportedException { SchemaDTO dto = new SchemaDTO(); uri(dto, uriInfo); AbstractFacade.CollectionInfo collectionInfo = tagSchemasFacade.findAll(resourceRequest.getOffset(), @@ -78,7 +79,7 @@ public SchemaDTO build(UriInfo uriInfo, ResourceRequest resourceRequest) } private SchemaDTO items(SchemaDTO dto, UriInfo uriInfo, ResourceRequest resourceRequest, - List items) throws SchematizedTagException { + List items) throws SchematizedTagException, NotSupportedException { ObjectMapper objectMapper = new ObjectMapper(); for(TagSchemas tag : items) { dto.addItem(buildItem(uriInfo, resourceRequest, tag, objectMapper)); @@ -88,7 +89,7 @@ private SchemaDTO items(SchemaDTO dto, UriInfo uriInfo, ResourceRequest resource private SchemaDTO buildItem(UriInfo uriInfo, ResourceRequest resourceRequest, TagSchemas tag, ObjectMapper objectMapper) - throws SchematizedTagException { + throws SchematizedTagException, NotSupportedException { SchemaDTO dto = new SchemaDTO(); uriItems(dto, uriInfo, tag); if (resourceRequest != null && resourceRequest.contains(ResourceRequest.Name.TAG_SCHEMAS)) { diff --git a/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagSchemasResource.java b/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagSchemasResource.java index bd106bff26..8367ff2fa9 100644 --- a/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagSchemasResource.java +++ b/hopsworks-api/src/main/java/io/hops/hopsworks/api/tags/TagSchemasResource.java @@ -21,6 +21,7 @@ import io.hops.hopsworks.common.api.ResourceRequest; import io.hops.hopsworks.common.tags.SchemaDTO; import io.hops.hopsworks.common.tags.TagSchemasControllerIface; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.jwt.annotation.JWTRequired; import io.hops.hopsworks.persistence.entity.user.security.apiKey.ApiScope; @@ -72,7 +73,7 @@ public class TagSchemasResource { public Response getAll(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, @BeanParam Pagination pagination, - @BeanParam TagsBeanParam tagsBeanParam) throws SchematizedTagException { + @BeanParam TagsBeanParam tagsBeanParam) throws SchematizedTagException, NotSupportedException { ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.TAG_SCHEMAS); resourceRequest.setOffset(pagination.getOffset()); @@ -93,7 +94,7 @@ public Response getAll(@Context SecurityContext sc, @Context UriInfo uriInfo, public Response get(@Context SecurityContext sc, @Context UriInfo uriInfo, @Context HttpServletRequest req, @PathParam("name") String schemaName) - throws SchematizedTagException { + throws SchematizedTagException, NotSupportedException { ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.TAG_SCHEMAS); SchemaDTO dto = tagSchemasBuilder.build(uriInfo, resourceRequest, schemaName); @@ -107,7 +108,7 @@ public Response get(@Context SecurityContext sc, @Context UriInfo uriInfo, public Response post(@Context SecurityContext sc, @Context UriInfo uriInfo, @QueryParam("name") String schemaName, String schema) - throws SchematizedTagException { + throws SchematizedTagException, NotSupportedException { tagSchemasController.create(schemaName, schema); ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.TAG_SCHEMAS); @@ -121,7 +122,7 @@ public Response post(@Context SecurityContext sc, @Context UriInfo uriInfo, @JWTRequired(acceptedTokens={Audience.API, Audience.JOB}, allowedUserRoles={"HOPS_ADMIN"}) @ApiKeyRequired( acceptedScopes = {ApiScope.FEATURESTORE}, allowedUserRoles={"HOPS_ADMIN"}) public Response delete(@Context SecurityContext sc, @Context UriInfo uriInfo, - @PathParam("name") String schemaName) { + @PathParam("name") String schemaName) throws NotSupportedException { tagSchemasController.delete(schemaName); return Response.noContent().build(); diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/keyword/KeywordControllerCommunity.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/keyword/KeywordControllerCommunity.java index 65a5a07369..52c5dbe5e4 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/keyword/KeywordControllerCommunity.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/keyword/KeywordControllerCommunity.java @@ -17,10 +17,43 @@ package io.hops.hopsworks.common.featurestore.keyword; import io.hops.hopsworks.common.integrations.CommunityStereotype; +import io.hops.hopsworks.exceptions.NotSupportedException; +import io.hops.hopsworks.persistence.entity.featurestore.featuregroup.Featuregroup; +import io.hops.hopsworks.persistence.entity.featurestore.featureview.FeatureView; +import io.hops.hopsworks.persistence.entity.featurestore.trainingdataset.TrainingDataset; +import io.hops.hopsworks.persistence.entity.project.Project; +import io.hops.hopsworks.persistence.entity.user.Users; +import io.hops.hopsworks.restutils.RESTCodes; import javax.ejb.Stateless; +import java.util.List; +import java.util.logging.Level; @Stateless @CommunityStereotype public class KeywordControllerCommunity implements KeywordControllerIface { + @Override + public List getAll(Project project, Users user, Featuregroup featureGroup, TrainingDataset trainingDataset, + FeatureView featureView) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); + } + + @Override + public List replaceKeywords(Project project, Users user, Featuregroup featureGroup, + TrainingDataset trainingDataset, FeatureView featureView, List keywords) + throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); + } + + @Override + public List deleteKeywords(Project project, Users user, Featuregroup featureGroup, + TrainingDataset trainingDataset, FeatureView featureView, List keywords) + throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); + } + + @Override + public List getUsedKeywords() throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); + } } diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/keyword/KeywordControllerIface.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/keyword/KeywordControllerIface.java index 7f3b16502c..3c167ceca7 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/keyword/KeywordControllerIface.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/keyword/KeywordControllerIface.java @@ -18,6 +18,7 @@ import io.hops.hopsworks.exceptions.FeaturestoreException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.persistence.entity.featurestore.featuregroup.Featuregroup; import io.hops.hopsworks.persistence.entity.featurestore.featureview.FeatureView; import io.hops.hopsworks.persistence.entity.featurestore.trainingdataset.TrainingDataset; @@ -28,25 +29,16 @@ public interface KeywordControllerIface { - default List getAll(Project project, Users user, Featuregroup featureGroup, TrainingDataset trainingDataset, - FeatureView featureView) - throws FeaturestoreException, MetadataException { - throw new IllegalArgumentException("API not supported in the community edition"); - } - - default List replaceKeywords(Project project, Users user, Featuregroup featureGroup, - TrainingDataset trainingDataset, FeatureView featureView, List keywords) - throws FeaturestoreException, MetadataException { - throw new IllegalArgumentException("API not supported in the community edition"); - } - - default List deleteKeywords(Project project, Users user, Featuregroup featureGroup, - TrainingDataset trainingDataset, FeatureView featureView, List keywords) - throws FeaturestoreException, MetadataException { - throw new IllegalArgumentException("API not supported in the community edition"); - } - - default List getUsedKeywords() throws FeaturestoreException { - throw new IllegalArgumentException("API not supported in the community edition"); - } + List getAll(Project project, Users user, Featuregroup featureGroup, TrainingDataset trainingDataset, + FeatureView featureView) throws FeaturestoreException, MetadataException, NotSupportedException; + + List replaceKeywords(Project project, Users user, Featuregroup featureGroup, TrainingDataset trainingDataset, + FeatureView featureView, List keywords) + throws FeaturestoreException, MetadataException, NotSupportedException; + + List deleteKeywords(Project project, Users user, Featuregroup featureGroup, TrainingDataset trainingDataset, + FeatureView featureView, List keywords) + throws FeaturestoreException, MetadataException, NotSupportedException; + + List getUsedKeywords() throws FeaturestoreException, NotSupportedException; } \ No newline at end of file diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/provenance/ops/ProvOpsControllerIface.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/provenance/ops/ProvOpsControllerIface.java index 4314e800e6..2e2c226fe4 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/provenance/ops/ProvOpsControllerIface.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/provenance/ops/ProvOpsControllerIface.java @@ -17,31 +17,20 @@ import io.hops.hopsworks.common.provenance.ops.dto.ProvLinksDTO; import io.hops.hopsworks.common.provenance.ops.dto.ProvOpsDTO; -import io.hops.hopsworks.exceptions.GenericException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.ProvenanceException; import io.hops.hopsworks.persistence.entity.project.Project; -import io.hops.hopsworks.restutils.RESTCodes; - -import java.util.logging.Level; public interface ProvOpsControllerIface { - default ProvOpsDTO provFileOpsList(Project project, ProvOpsParamBuilder params) - throws ProvenanceException, GenericException { - throw new GenericException(RESTCodes.GenericErrorCode.ENTERPRISE_FEATURE, Level.FINE); - } - - default ProvOpsDTO provFileOpsCount(Project project, ProvOpsParamBuilder params) - throws ProvenanceException, GenericException { - throw new GenericException(RESTCodes.GenericErrorCode.ENTERPRISE_FEATURE, Level.FINE); - } - - default ProvOpsDTO provFileOpsAggs(Project project, ProvOpsParamBuilder params) - throws ProvenanceException, GenericException { - throw new GenericException(RESTCodes.GenericErrorCode.ENTERPRISE_FEATURE, Level.FINE); - } + ProvOpsDTO provFileOpsList(Project project, ProvOpsParamBuilder params) + throws ProvenanceException, NotSupportedException; + + ProvOpsDTO provFileOpsCount(Project project, ProvOpsParamBuilder params) + throws ProvenanceException, NotSupportedException; - default ProvLinksDTO provLinks(Project project, ProvLinksParamBuilder params, boolean filterAlive) - throws ProvenanceException, GenericException { - throw new GenericException(RESTCodes.GenericErrorCode.ENTERPRISE_FEATURE, Level.FINE); - } + ProvOpsDTO provFileOpsAggs(Project project, ProvOpsParamBuilder params) + throws ProvenanceException, NotSupportedException; + + ProvLinksDTO provLinks(Project project, ProvLinksParamBuilder params, boolean filterAlive) + throws ProvenanceException, NotSupportedException; } diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/provenance/ops/ProvOpsControllerImpl.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/provenance/ops/ProvOpsControllerImpl.java index e49b134f19..49459cbf7d 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/provenance/ops/ProvOpsControllerImpl.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/provenance/ops/ProvOpsControllerImpl.java @@ -16,13 +16,42 @@ package io.hops.hopsworks.common.provenance.ops; import io.hops.hopsworks.common.integrations.CommunityStereotype; +import io.hops.hopsworks.common.provenance.ops.dto.ProvLinksDTO; +import io.hops.hopsworks.common.provenance.ops.dto.ProvOpsDTO; +import io.hops.hopsworks.exceptions.NotSupportedException; +import io.hops.hopsworks.persistence.entity.project.Project; +import io.hops.hopsworks.restutils.RESTCodes; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; +import java.util.logging.Level; @Stateless @CommunityStereotype @TransactionAttribute(TransactionAttributeType.NEVER) public class ProvOpsControllerImpl implements ProvOpsControllerIface { + @Override + public ProvOpsDTO provFileOpsList(Project project, ProvOpsParamBuilder params) + throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); + } + + @Override + public ProvOpsDTO provFileOpsCount(Project project, ProvOpsParamBuilder params) + throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); + } + + @Override + public ProvOpsDTO provFileOpsAggs(Project project, ProvOpsParamBuilder params) + throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); + } + + @Override + public ProvLinksDTO provLinks(Project project, ProvLinksParamBuilder params, boolean filterAlive) + throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); + } } diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagController.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagController.java index ee0a164382..f3630a8f3e 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagController.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagController.java @@ -17,44 +17,48 @@ import io.hops.hopsworks.common.dataset.util.DatasetPath; import io.hops.hopsworks.common.integrations.CommunityStereotype; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.persistence.entity.user.Users; +import io.hops.hopsworks.restutils.RESTCodes; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import java.util.Map; +import java.util.logging.Level; @Stateless @CommunityStereotype @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public class TagController implements TagControllerIface { @Override - public String get(Users user, DatasetPath path, String name) { - throw new IllegalArgumentException("API not supported in the community edition"); + public String get(Users user, DatasetPath path, String name) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public Map getAll(Users user, DatasetPath path) { - throw new IllegalArgumentException("API not supported in the community edition"); + public Map getAll(Users user, DatasetPath path) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public AttachTagResult upsert(Users user, DatasetPath path, String name, String value) { - throw new IllegalArgumentException("API not supported in the community edition"); + public AttachTagResult upsert(Users user, DatasetPath path, String name, String value) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public AttachTagResult upsertAll(Users user, DatasetPath path, Map newTags) { - throw new IllegalArgumentException("API not supported in the community edition"); + public AttachTagResult upsertAll(Users user, DatasetPath path, Map newTags) + throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public void delete(Users user, DatasetPath path, String name) { - throw new IllegalArgumentException("API not supported in the community edition"); + public void delete(Users user, DatasetPath path, String name) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public void deleteAll(Users user, DatasetPath path) { - throw new IllegalArgumentException("API not supported in the community edition"); + public void deleteAll(Users user, DatasetPath path) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } } diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagControllerIface.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagControllerIface.java index a635dfc15c..00de597490 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagControllerIface.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagControllerIface.java @@ -18,6 +18,7 @@ import io.hops.hopsworks.common.dataset.util.DatasetPath; import io.hops.hopsworks.exceptions.DatasetException; import io.hops.hopsworks.exceptions.MetadataException; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.user.Users; @@ -25,20 +26,20 @@ public interface TagControllerIface { String get(Users user, DatasetPath path, String name) - throws DatasetException, MetadataException, SchematizedTagException; + throws DatasetException, MetadataException, SchematizedTagException, NotSupportedException; Map getAll(Users user, DatasetPath path) - throws DatasetException, MetadataException; + throws DatasetException, MetadataException, NotSupportedException; AttachTagResult upsert(Users user, DatasetPath path, String name, String value) - throws MetadataException, SchematizedTagException; + throws MetadataException, SchematizedTagException, NotSupportedException; AttachTagResult upsertAll(Users user, DatasetPath path, Map newTags) - throws MetadataException, SchematizedTagException; + throws MetadataException, SchematizedTagException, NotSupportedException; void delete(Users user, DatasetPath path, String name) - throws DatasetException, MetadataException; + throws DatasetException, MetadataException, NotSupportedException; void deleteAll(Users user, DatasetPath path) - throws MetadataException, DatasetException; + throws MetadataException, DatasetException, NotSupportedException; } diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagSchemasController.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagSchemasController.java index 2d8766ee48..ef1a0310a8 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagSchemasController.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagSchemasController.java @@ -18,41 +18,45 @@ import com.fasterxml.jackson.databind.ObjectMapper; import io.hops.hopsworks.common.integrations.CommunityStereotype; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.persistence.entity.featurestore.tag.TagSchemas; +import io.hops.hopsworks.restutils.RESTCodes; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import java.util.Map; +import java.util.logging.Level; @Stateless @CommunityStereotype @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) public class TagSchemasController implements TagSchemasControllerIface { @Override - public void create(String name, String schema) { - throw new IllegalArgumentException("API not supported in the community edition"); + public void create(String name, String schema) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public void delete(String name) { - throw new IllegalArgumentException("API not supported in the community edition"); + public void delete(String name) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public void delete(TagSchemas tag) { - throw new IllegalArgumentException("API not supported in the community edition"); + public void delete(TagSchemas tag) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public Map getAll() { - throw new IllegalArgumentException("API not supported in the community edition"); + public Map getAll() throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public boolean schemaHasNestedTypes(String schema) { - throw new IllegalArgumentException("API not supported in the community edition"); + public boolean schemaHasNestedTypes(String schema) throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } @Override - public boolean schemaHasAdditionalRules(String name, String schema, ObjectMapper objectMapper) { - throw new IllegalArgumentException("API not supported in the community edition"); + public boolean schemaHasAdditionalRules(String name, String schema, ObjectMapper objectMapper) + throws NotSupportedException { + throw new NotSupportedException(RESTCodes.NotSupportedErrorCode.ENTERPRISE_FEATURE, Level.INFO); } } diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagSchemasControllerIface.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagSchemasControllerIface.java index c626ebb68e..61c84097c0 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagSchemasControllerIface.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/tags/TagSchemasControllerIface.java @@ -17,18 +17,19 @@ package io.hops.hopsworks.common.tags; import com.fasterxml.jackson.databind.ObjectMapper; +import io.hops.hopsworks.exceptions.NotSupportedException; import io.hops.hopsworks.exceptions.SchematizedTagException; import io.hops.hopsworks.persistence.entity.featurestore.tag.TagSchemas; import java.util.Map; public interface TagSchemasControllerIface { - void create(String name, String schema) throws SchematizedTagException; - void delete(String name); - void delete(TagSchemas tag); - Map getAll(); + void create(String name, String schema) throws SchematizedTagException, NotSupportedException; + void delete(String name) throws NotSupportedException; + void delete(TagSchemas tag) throws NotSupportedException; + Map getAll() throws NotSupportedException; - boolean schemaHasNestedTypes(String schema) throws SchematizedTagException; + boolean schemaHasNestedTypes(String schema) throws SchematizedTagException, NotSupportedException; boolean schemaHasAdditionalRules(String name, String schema, ObjectMapper objectMapper) - throws SchematizedTagException; + throws SchematizedTagException, NotSupportedException; } diff --git a/hopsworks-rest-utils/src/main/java/io/hops/hopsworks/exceptions/NotSupportedException.java b/hopsworks-rest-utils/src/main/java/io/hops/hopsworks/exceptions/NotSupportedException.java new file mode 100644 index 0000000000..8781381076 --- /dev/null +++ b/hopsworks-rest-utils/src/main/java/io/hops/hopsworks/exceptions/NotSupportedException.java @@ -0,0 +1,41 @@ +/* + * This file is part of Hopsworks + * Copyright (C) 2022, Logical Clocks AB. All rights reserved + * + * Hopsworks is free software: you can redistribute it and/or modify it under the terms of + * the GNU Affero General Public License as published by the Free Software Foundation, + * either version 3 of the License, or (at your option) any later version. + * + * Hopsworks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License along with this program. + * If not, see . + */ + +package io.hops.hopsworks.exceptions; + +import io.hops.hopsworks.restutils.RESTCodes; +import io.hops.hopsworks.restutils.RESTException; + +import java.util.logging.Level; + +public class NotSupportedException extends RESTException { + public NotSupportedException(RESTCodes.NotSupportedErrorCode errorCode, Level level) { + super(errorCode, level); + } + + public NotSupportedException(RESTCodes.NotSupportedErrorCode errorCode, Level level, String usrMsg) { + super(errorCode, level, usrMsg); + } + + public NotSupportedException(RESTCodes.NotSupportedErrorCode errorCode, Level level, String usrMsg, String devMsg) { + super(errorCode, level, usrMsg, devMsg); + } + + public NotSupportedException(RESTCodes.NotSupportedErrorCode errorCode, Level level, String usrMsg, String devMsg, + Throwable throwable) { + super(errorCode, level, usrMsg, devMsg, throwable); + } +} diff --git a/hopsworks-rest-utils/src/main/java/io/hops/hopsworks/restutils/RESTCodes.java b/hopsworks-rest-utils/src/main/java/io/hops/hopsworks/restutils/RESTCodes.java index ea93f8de20..8d649c1102 100644 --- a/hopsworks-rest-utils/src/main/java/io/hops/hopsworks/restutils/RESTCodes.java +++ b/hopsworks-rest-utils/src/main/java/io/hops/hopsworks/restutils/RESTCodes.java @@ -2355,4 +2355,39 @@ public int getRange() { return range; } } + + public enum NotSupportedErrorCode implements RESTErrorCode { + ENTERPRISE_FEATURE(0, "API not supported in the community edition", + Response.Status.NOT_IMPLEMENTED); + + private Integer code; + private String message; + private Response.Status respStatus; + public final int range = 600000; + + NotSupportedErrorCode(Integer code, String message, Response.Status respStatus) { + this.code = range + code; + this.message = message; + this.respStatus = respStatus; + } + + @Override + public Integer getCode() { + return code; + } + + @Override + public String getMessage() { + return message; + } + + public Response.StatusType getRespStatus() { + return respStatus; + } + + @Override + public int getRange() { + return range; + } + } }