Niels.

I got a bit lost in our Resources port discussion, where we last left off
...

GeoServerResourceLoader
<https://github.com/geoserver/geoserver/blob/master/src/platform/src/main/java/org/geoserver/platform/GeoServerResourceLoader.java#L107>
was acquiring the base directory location using the following:

    public GeoServerResourceLoader(ResourceStore resourceStore) {
        this.baseDirectory = resourceStore.get(Paths.BASE).dir();
        this.resources = resourceStore;
    }

I agree that an API change is needed to prevent this from happening.

I also note that these constructors are a bit confusing to tell what is
provided for testing purposes, and what is provided for use at runtime. We
should try and take better notes in the javadocs.

The official way to find the location of the GEOSERVER_BASE_DIRECTORY is
via GeoServerResourceLoader.lookupGeoServerDataDirectory(servletContext).
Admittedly this location is not cached.

I will try and prepare a patch to clarify javadocs, and replace the above
with something like:

    public GeoServerResourceLoader(ResourceStore resourceStore) {
        if( resourceStore instanceof FileSystemResourceStore){
            FileSystemResourceStore files = (FileSystemResourceStore)
resourceStore;
            this.baseDirectory = files.getBaseDirectory();
        }
        else {
            this.baseDirectory = null; // client code will supply via
setBaseDirectory
        }
        this.resources = resourceStore;
    }


--
Jody Garnett
------------------------------------------------------------------------------
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to