This week's book giveaway is in the Other Open Source APIs forum. We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line! See this thread for details.
Can anyone help me with the problem below I have a small java application that takes image data from a d/b and formats it as a bmp to write to a directory on a unix box to be used by other applications. (for reporting etc). This runs via the oracle 9ias application server. Problem The original version of this app only provided an image in png format for display on screen (for reports etc) but we have since found that some reports for external customers required the image as a saved version on the file system. To this end I produced a new version of the image retriever that now produces the image for report display and writes a .bmp version of the image to the file system for use by external reports etc. The problem I'm having is that when the bmp is created it is only has permissions for user and group to read (e.g. -rw-r-----). The external reports are run using another user id which then does not have permissions to read the file. The first thing I tried was to change the umask for the user running ias so that files created by that user have default permissions with read access for all users, however this did not work and the permission remained as that above. I have also tried changing the java code to override default permissions using FilePermission, this works in that you can change the permissions of the file being created but only for the user and group part of the permission (e.g. -rwxrwx---) I am not sure whether these default permissions are caused by a) the Unix environment for the ias user b) 9ias itself c) something I am missing in the java code Any help would be gratefully recieved.
Yep, Odds are that the file's being created owned by the appserver and with limited rights for security purposes. I don't think access rights are portable enough to be part of Java, so you'll have to do some external magic. The simplest way is to simply add the consumers to the group under which the file is produced. This is clean, requires no programming, and in harmony with how Unix/Linux file access rights are intended to be used. However, if the list of consumers is large and/or fluid, more extreme measures may be called for. The next easiest way would be to invoke runtime.exec to execute the chmod shell command. Finally, you may be able to find a JNI package that manages file rights for you. This will be less portable, but probably less overhead. You can also do some variants, if they fit well, such as making the images downloadable via HTTP or FTP.
Customer surveys are for companies who didn't pay proper attention to begin with.