Ticket #884 (closed Enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

Files API: support user with constructing repository paths

Reported by: jri Owned by: jri
Priority: Major Milestone: Release 4.8
Component: DeepaMehta Standard Distribution Version: 4.7
Keywords: Cc: dgf, Malte
Complexity: 3 Area: Application Framework / API
Module: deepamehta-files

Description (last modified by jri) (diff)

In conjunction with the per-workspace file repos feature (#815) the API user needs support with constructing repository paths. In particular the developer should not be required to inspect the per-workspace config value and the workspace cookie.

This could be done by adding this method to the Files service:

String pathPrefix()

This method returns the prefix the developer can use when constructing a repository path. In case of per-workspace file repos are activated the prefix represents the current workspace (e.g. "/workspace-1234", based on the workspace cookie). In case of per-workspace file repos are NOT activated an empty string is returned. The plugin will work in both cases then: with or without per-workspace file repos.

Another method should be added:

boolean fileExists(String repoPath)

It checks if a file/directory exists in the file repo. Currently this is possible only with getFile(String repoPath) but this method expects the file/directory to exist, and otherwise throws a FileRepositoryException with a 404 status code.

Thank you, Malte, for revealing these needs!

Change History

comment:1 Changed 5 years ago by jri

  • Status changed from new to accepted

comment:2 Changed 5 years ago by jri

  • Description modified (diff)

comment:3 Changed 5 years ago by Jörg Richter <jri@…>

In ab314297740e57796d327e7a9097a796f375bd10/deepamehta:

Files API: add fileExists() method (#884).

1 new method:

boolean fileExists(String repoPath)

Checks if a file/directory with the given repository path exists in the file repository.

See #884.

comment:4 Changed 5 years ago by Jörg Richter <jri@…>

In 7d8252de88707a068a5fec4ac7e547d2ea1735bf/deepamehta:

Files API: add 2 pathPrefix() methods (#884).

2 new methods in Files API:

String pathPrefix()

Returns a prefix that can be used for constructing a repository path.
In case of per-workspace file repos are activated (dm4.filerepo.per_workspace=true) the prefix
represents the current workspace (e.g. /workspace-1234), based on the workspace cookie.
In case of per-workspace file repos are not activated an empty string is returned.

String pathPrefix(long workspaceId)

Returns a prefix that can be used for constructing a repository path.
In case of per-workspace file repos are activated (dm4.filerepo.per_workspace=true) the prefix
represents the given workspace (e.g. /workspace-1234).
In case of per-workspace file repos are not activated an empty string is returned.

See #884.

comment:5 Changed 5 years ago by Jörg Richter <jri@…>

In 8785531d5a919e96ea0f10c4795beafd33361cba/deepamehta:

Files API: extend apidocs (#884).

See #884.

comment:6 Changed 5 years ago by jri

  • Status changed from accepted to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.