I have a JavaEE application that needs to access a file in order to obtain certain informations about the installation.
This access is read-only, I do not need to change that file within the application, i.e. I do not need the "file" directly, just it's content (a byte array).
There's a restriction on EJBs using the filesystem. I do understand the problems associated with it but I can't figure out a alternative solution to this.
The file path should be configurable by the user, but there's no need to track changes to the file contents. Once loaded, it stays the same unless the user choose another file. So, I can't package it within the application archive.
This file-based approach is a decision made long time ago by some legacy systems we have. There's no practical way to change it now, i.e. I need that my JavaEE application uses the file (at least once) to load it's content.
Another restriction is that this file can not be persisted on the database.
How should I do this without violating the EJB restriction of filesystem access?
I thought about user uploading the file to the server and then persisting this information on the server. But how do I do this? This information should be globally accessible, including multiple instances of the server (e.g. in a cluster architecture).
The user should configure this file once (not necessarily within the main application, it could be other app just to configure this). Even if the server restart, the file's content should still be accessible without any further configuration by the user.
I'm using JavaEE 5 with EJB 3.0 specification on a GlassFish v2.1.1 server.
Thanks, Thiago.
My suggestion is as follows:
Hope it can be useful.