Ticket #881 (closed Defect: worksforme)

Opened 5 years ago

Last modified 5 years ago

dm4-files: getResourceInfo and getDirectoryListing behave unexpected to me

Reported by: Malte Owned by: jri
Priority: Major Milestone:
Component: DeepaMehta Standard Distribution Version: 4.7
Keywords: Cc:
Complexity: 3 Area:
Module:

Description

Please have a look at the log file of the following three calls, this is using the FilesServices.getResourceInfo()-call, when per_workspace=true:

Using FilesService?.getFile("/"):

Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.images.ImagePlugin browse
INFORMATION: browse images
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin getFile
INFORMATION: Accessing the file at "/"
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin checkPath
INFORMATION: Checking path "/home/malted/Schreibtisch/filerepo-test/workspace-2237"
  dm4.filerepo.path="/home/malted/Schreibtisch/filerepo-test" => PATH OK
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin checkExistence
INFORMATION: Checking existence of "/home/malted/Schreibtisch/filerepo-test/workspace-2237" => EXISTS

OK!

Now, using "FilesService?.getResourceInfo("/images")":

Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.images.ImagePlugin createImagesDirectoryInFileRepo
INFORMATION: createImagesDir is using getResourceInfo with a SIMPLE /images
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin getResourceInfo
INFORMATION: Getting resource info for repository path "/images"
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin checkPath
INFORMATION: Checking path "/home/malted/Schreibtisch/filerepo-test/images"
  dm4.filerepo.path="/home/malted/Schreibtisch/filerepo-test" => PATH OK
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin checkExistence
INFORMATION: Checking existence of "/home/malted/Schreibtisch/filerepo-test/images" => EXISTS

I wonder why is getResourceInfo() (a FilesService?-Call) doing this despite the per_workspace filrepo flag is to true`?

You wrote:

When you pass "/" as repo path the respective FilesServices?? call will add the /workspace-1234 prefix automatically (based on the cookie).

I understood that as: When you pass a relative path (starting with "/") to a respective FilesService? call, the internal prefix will be added automatically, which would make sense to me. Nonetheless, the same result as above with just "FilesService?.getResourceInfo("images")";

This behaviour (a getResourceInfo()-call and probably also the getDirectoryListing()-call) are then somehow inconsistent with the implementation of getFile() and that makes the FilesService? hard to use.

Combining the very first call (getting the root directory of the current repo) with the latter (checking a resource) makes no difference. I can not easily determine if a folder exists in a given filerepo just through using the FilesService? (see #880).

Now trying to utilize the "repoDir" with getResourceInfo(repoDir + "/" + images) this happens:

Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.images.ImagePlugin createImagesDirectoryInFileRepo
INFORMATION: createImagesDir is using getResourceInfo with repoDir /home/malted/Schreibtisch/filerepo-test/workspace-2237/images
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin getResourceInfo
INFORMATION: Getting resource info for repository path "/home/malted/Schreibtisch/filerepo-test/workspace-2237/images"
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin checkPath
INFORMATION: Checking path "/home/malted/Schreibtisch/filerepo-test/home/malted/Schreibtisch/filerepo-test/workspace-2237/images"
  dm4.filerepo.path="/home/malted/Schreibtisch/filerepo-test" => PATH OK
Nov 11, 2015 10:59:52 AM de.deepamehta.plugins.files.FilesPlugin checkExistence
INFORMATION: Checking existence of "/home/malted/Schreibtisch/filerepo-test/home/malted/Schreibtisch/filerepo-test/workspace-2237/images" => NOT FOUND

This looks to me as the correct parameters are given to the FilesService? but the existence check is done at a completely different location and this means that i would have to construct the workspace prefix by myself for checking for a repo existens.

I think it would be great if all the FilesServices?-Calls would a) support this case and b) maybe could handle relative paths (starting with "/") always as relative to either the workspace or global filerepo (depeding on the setting). Would this be possible? Do you want to go for this?

Change History

comment:1 Changed 5 years ago by jri

See this posting for a discussion of this problem:
http://lists.deepamehta.de/pipermail/devel-lists.deepamehta.de/2015-November/000605.html

See #884 for the aimed solution.

comment:2 Changed 5 years ago by jri

  • Status changed from new to closed
  • Resolution set to worksforme

#884 is meanwhile realized

Note: See TracTickets for help on using tickets.