Support loading the xml configuration from a read-only filesystem #1375
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Refactor
XMLFileResourceProvider
to support read-only configuration directories.Enhances
XMLFileResourceProvider
to allow GeoWebCache to start with a read-only configuration directory andgeowebcache.xml
file. Previously, the provider assumed that the configuration directory was always writable, which caused startup failures when running in environments with restricted file permissions.Support read-only configuration directories:
hasInput()
now correctly returnstrue
if the configuration file exists or if a template is available and the directory is writable.hasOutput()
ensures that the configuration file can be written before allowing output operations.Refactored file existence checks:
findConfigFile()
.findConfigFile()
tofindOrCreateConfFile()
to prevent premature failures.Improved logging and exception handling:
hasInput()
andhasOutput()
now log warnings when encountering errors instead of failing silently.findOrCreateConfFile()
now explicitly throws an exception when it cannot create a new configuration file due to permission issues.GeoWebCache can now start successfully with a pre-existing, read-only configuration directory.
Configurations stored in a read-only filesystem (e.g., mounted from a read-only volume) can still be used without requiring write access.
The provider only attempts to create a configuration file when explicitly required, eliminating side effects from query methods
hasInput()
andhasOutput()
.This change improves the resilience of GeoWebCache in constrained environments while maintaining backward compatibility for writable configurations.