Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 414596 - [server] IMetaStore.updateProject() API is not sufficient
Summary: [server] IMetaStore.updateProject() API is not sufficient
Status: RESOLVED FIXED
Alias: None
Product: Orion
Classification: ECD
Component: Server (show other bugs)
Version: 4.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.0 M1   Edit
Assignee: Anthony Hunter CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 412995
  Show dependency tree
 
Reported: 2013-08-07 12:13 EDT by Anthony Hunter CLA
Modified: 2013-08-13 14:35 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Hunter CLA 2013-08-07 12:13:37 EDT
The simple metadata storage ( Bug 412995 ) feature has a design where workspaces and projects are organized in folders in a hierarchy under the user they belong to.

The API to create a project in a MetaStore is createProject(String workspaceId, ProjectInfo info)

Based on this API, I do not know where to create the project, as I do not know the project or workspace owner.

I thought I would be smart and make the workspaceId an encoding of the userId and workspace name. This allows me to create a project by getting the user and workspace from the workspaceId and then creating a project underneath. 

This is really a hack and is not working sufficiently. I need both the user and workspace when I get a request to create a project.

By this same argument, the updateProject API is also not working.

The API is updateProject(ProjectInfo project). I have no way to figure out which user and workspace in which the project without encoding the user, workspace into the projectId.

To resolve, I propose the ProjectInfo should include the user and workspace. As well the WorkspaceInfo should include the user. This will simplify the IMetaStore API since all the create, read, update and delete methods simply need to pass in a MetadataInfo.
Comment 1 Anthony Hunter CLA 2013-08-08 12:14:34 EDT
The API for a MetadataInfo object says that the UniqueId is globally unique. As a result we depend on the workspaceId to lookup projects and in many places pass around path objects in the form /workspace/{id}/project/{id} without any user information. This is especially true in the git implementation.

I am not going to be able to work around this limitation right now and will go back to encoding the user and workspace in the workspaceId.
Comment 2 Anthony Hunter CLA 2013-08-08 15:07:48 EDT
(In reply to comment #0)
> The API to create a project in a MetaStore is createProject(String
> workspaceId, ProjectInfo info)

I am leaving this API as is.

> By this same argument, the updateProject API is also not working.
> 
> The API is updateProject(ProjectInfo project). I have no way to figure out
> which user and workspace in which the project without encoding the user,
> workspace into the projectId.
> 
> To resolve, I propose the ProjectInfo should include the user and workspace.
> As well the WorkspaceInfo should include the user. This will simplify the
> IMetaStore API since all the create, read, update and delete methods simply
> need to pass in a MetadataInfo.

I still require this change.
Comment 3 Anthony Hunter CLA 2013-08-13 14:35:42 EDT
The IMetaData API has been changed as follows:

WorkspaceInfo contains the field userId, the user that owns the workspace.

ProjectInfo contains the field workspaceId, the workspace that contains the project.

userId and workspaceId parameters on the createWorkspace() and createProject() methods has been removed since these parameters are no available in the MetaInfo.

updateWorkspace() and updateProject() methods are unchanged since the required Id information is provided in the MetaInfo parameter.

The changes are in http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=a7e1e46e357feace186ec480fc53c72597c540e8