Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOPSWORKS-3297] community - not supported enterprise features #1157

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.hops.hopsworks.common.dataset.util.DatasetPath;
import io.hops.hopsworks.common.hdfs.inode.InodeController;
import io.hops.hopsworks.exceptions.DatasetException;
import io.hops.hopsworks.exceptions.GenericException;
import io.hops.hopsworks.exceptions.MetadataException;
import io.hops.hopsworks.exceptions.SchematizedTagException;
import io.hops.hopsworks.persistence.entity.dataset.Dataset;
Expand Down Expand Up @@ -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, GenericException {
expand(dto, resourceRequest);
if (dto.isExpand()) {
Dataset dataset = datasetPath.getDataset();
Expand Down Expand Up @@ -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, GenericException {
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, GenericException {
DatasetDTO dto = new DatasetDTO();
uri(dto, uriInfo);
build(dto, uriInfo, resourceRequest, user, datasetPath, parentPath, dirOwner);
Expand All @@ -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, GenericException {
DatasetDTO dto = new DatasetDTO();
uriItems(dto, uriInfo, datasetPath);
return build(dto, uriInfo, resourceRequest, user, datasetPath, parentPath, dirOwner);
Expand All @@ -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, GenericException {
Dataset dataset = datasetController.getByProjectAndDsName(accessProject, null, name);
if (dataset == null) {
throw new DatasetException(RESTCodes.DatasetErrorCode.DATASET_NOT_FOUND, Level.FINE);
Expand All @@ -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, GenericException {
Inode parent = project.getInode();
datasetHelper.checkResourceRequestLimit(resourceRequest, parent.getChildrenNum());
String parentPath = inodeController.getPath(parent);
Expand All @@ -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, GenericException {
uri(dto, uriInfo);
expand(dto, resourceRequest);
if (dto.isExpand()) {
Expand All @@ -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, GenericException {
AbstractFacade.CollectionInfo collectionInfo = datasetFacade.findAllDatasetByProject(null, null,
resourceRequest.getFilter(), resourceRequest.getSort(), accessProject);
dto.setCount(collectionInfo.getCount());
Expand All @@ -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, GenericException {
AbstractFacade.CollectionInfo collectionInfo = datasetSharedWithFacade.findAllDatasetByProject(null, null,
resourceRequest.getFilter(), resourceRequest.getSort(), accessProject);
dto.setCount(collectionInfo.getCount());
Expand All @@ -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<Dataset> datasets, Project accessProject, Users user, String parentPath, Users dirOwner)
throws DatasetException, MetadataException, SchematizedTagException {
throws DatasetException, MetadataException, SchematizedTagException, GenericException {
if (datasets != null && !datasets.isEmpty()) {
for(Dataset dataset : datasets) {
DatasetPath datasetPath = datasetHelper.getTopLevelDatasetPath(accessProject, dataset);
Expand All @@ -290,7 +291,7 @@ private DatasetDTO datasetSharedWithItems(DatasetDTO dto, UriInfo uriInfo, Resou
Project accessProject, Users user,
List<DatasetSharedWith> datasetSharedWithList, String parentPath,
Users dirOwner)
throws DatasetException, MetadataException, SchematizedTagException {
throws DatasetException, MetadataException, SchematizedTagException, GenericException {
if (datasetSharedWithList != null && !datasetSharedWithList.isEmpty()) {
for(DatasetSharedWith datasetSharedWith : datasetSharedWithList) {
DatasetPath datasetPath = datasetHelper.getTopLevelDatasetPath(accessProject, datasetSharedWith);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import io.hops.hopsworks.common.provenance.core.dto.ProvTypeDTO;
import io.hops.hopsworks.exceptions.DatasetException;
import io.hops.hopsworks.exceptions.FeaturestoreException;
import io.hops.hopsworks.exceptions.GenericException;
import io.hops.hopsworks.exceptions.HopsSecurityException;
import io.hops.hopsworks.exceptions.MetadataException;
import io.hops.hopsworks.exceptions.ProjectException;
Expand Down Expand Up @@ -153,7 +154,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, GenericException {
Users user = jWTHelper.getUserPrincipal(sc);
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.DATASET);
resourceRequest.setOffset(pagination.getOffset());
Expand Down Expand Up @@ -191,7 +192,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, GenericException {
Users user = jwtHelper.getUserPrincipal(sc);
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.INODES);
resourceRequest.setExpansions(datasetExpansionBeanParam.getResources());
Expand Down Expand Up @@ -247,8 +248,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, GenericException {
Users user = jwtHelper.getUserPrincipal(sc);
DatasetPath datasetPath;
DatasetPath distDatasetPath;
Expand Down Expand Up @@ -288,7 +289,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:
Expand Down Expand Up @@ -380,7 +382,8 @@ public Response update(@PathParam("path") String path, @QueryParam("type") Datas
@QueryParam("target_project") String targetProjectName,
@Context UriInfo uriInfo,
@Context SecurityContext sc)
throws DatasetException, ProjectException, MetadataException, SchematizedTagException, FeaturestoreException {
throws ProjectException, DatasetException, SchematizedTagException, GenericException, MetadataException,
FeaturestoreException {
Project project = this.getProject();
DatasetPath datasetPath = datasetHelper.getDatasetPath(project, path, datasetType);
ResourceRequest resourceRequest = new ResourceRequest(ResourceRequest.Name.DATASET);
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import io.hops.hopsworks.common.dataset.FilePreviewMode;
import io.hops.hopsworks.common.util.Settings;
import io.hops.hopsworks.exceptions.DatasetException;
import io.hops.hopsworks.exceptions.GenericException;
import io.hops.hopsworks.exceptions.MetadataException;
import io.hops.hopsworks.exceptions.SchematizedTagException;
import io.hops.hopsworks.persistence.entity.hdfs.inode.Inode;
Expand Down Expand Up @@ -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, GenericException {
InodeDTO dto = new InodeDTO();
uri(dto, uriInfo, inode);
expand(dto, resourceRequest);
Expand Down Expand Up @@ -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, GenericException {
InodeDTO dto = new InodeDTO();
uri(dto, uriInfo);
expand(dto, resourceRequest);
Expand All @@ -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, GenericException {
InodeDTO dto = new InodeDTO();
uri(dto, uriInfo);
expand(dto, resourceRequest);
Expand All @@ -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, GenericException {
Inode inode = datasetPath.getInode();
if (inode == null) {
throw new DatasetException(RESTCodes.DatasetErrorCode.PATH_NOT_FOUND, Level.FINE);
Expand All @@ -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, GenericException {
Inode inode = datasetPath.getInode();
if (inode == null) {
throw new DatasetException(RESTCodes.DatasetErrorCode.PATH_NOT_FOUND, Level.FINE);
Expand All @@ -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, GenericException {
Inode parent = datasetPath.getInode();
if (parent == null) {
throw new DatasetException(RESTCodes.DatasetErrorCode.PATH_NOT_FOUND, Level.FINE);
Expand All @@ -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, GenericException {
uri(dto, uriInfo);
Users dirOwner = userFacade.findByUsername(parent.getHdfsUser().getUsername());
datasetHelper.checkResourceRequestLimit(resourceRequest, parent.getChildrenNum());
Expand All @@ -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, GenericException {
expand(dto, resourceRequest);
AbstractFacade.CollectionInfo collectionInfo;
if (dto.isExpand()) {
Expand All @@ -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<Inode> inodes, Users dirOwner)
throws DatasetException, SchematizedTagException, MetadataException {
throws DatasetException, SchematizedTagException, MetadataException, GenericException {
if (inodes != null && !inodes.isEmpty()) {
for(Inode inode : inodes) {
dto.addItem(buildStat(uriInfo, resourceRequest, user, datasetPath, inode, dirOwner));
Expand Down
Loading