[Geoserver-devel] ResourceStore progress, and the next pull request

Thanks to Andrea for reviewing the first GSIP 106 - Managed File API pull request #531.

I have a second pull request ready adding file locks (any volunteers?):

With #531 reviewed and applied to master the API the ResourceStore API is available to try out.

For examples: ResourceStore API Examples

Jody Garnett

For examples: ResourceStore API Examples<http://geoserver.org/display/GEOS/ResourceStore+API+Examples&gt;

Actually if you are using Eclipse there is a short cut:
1. Selecting any reference to GeoServerDataDirectory or
GeoServerResourceLoader

File f = loader.*find*("monitoring", "GeoLiteCity.dat");
if (f != null) {
   return new LookupService(f);
}

2. Right click on the method and select Refactor -> Inline

Resource resource = loader.get( Paths.path("monitoring", "GeoLiteCity.dat")
);
File f = Resources.find( resource );
if (f != null) {
      return new LookupService(f);
}

3. The inlined code made use of a utility method Resources.find( resource )
to reproduce the logic of GeoServerResourceLoader based on
Resource.getType(). Type will be UNDEFINED, DIRECTORY or RESOURCE, with
that in mind we can make this a bit more clear:

Resource resource = loader.get( Paths.path("monitoring", "GeoLiteCity.dat")
);
if( resource.getType() == Type.RESOURCE) {
    return new LookupService(resource.file());
}