jsr345-experts@ejb-spec.java.net

[jsr345-experts] java.io.File

From: Antonio Goncalves <antonio.goncalves_at_gmail.com>
Date: Sun, 25 Sep 2011 21:08:01 +0200

Hi all,

I have on concern about EJBs not being allowed to use files. Under
section 16.2.2- Programming Restrictions, you can read :

*"An enterprise bean must not use the java.io package to attempt to access
files and directories in the file system.*
*The file system APIs are not well-suited for business components to access
data. Business components should use a resource manager API, such as JDBC,
to store data."*

But in projects, I see that all the time : EJBs reading and writing files. I
haven't tried all the containers but I really wonder if this restriction is
really taken into account. With the new EJBContainer, the nicer EJBTimer and
asynchronous calls we could think EJBs are the perfect match for batch
processing... but there is the java.io package restriction.

Is this restriction too hard ? Could we smooth it ? I can understand that
accessing files in a distributed environment without a shared disk is
problematic, but why don't we encourage batch processing with embedded
EJBContainer ? We could maybe do some distinction between javai.io package
within the EJBContainer and the java.io package in a running environment.

Any thoughts ?

-- 
Antonio Goncalves
Software architect and Java Champion
Web site <http://www.antoniogoncalves.org> |
Twitter<http://twitter.com/agoncal>|
Blog <http://feeds.feedburner.com/AntonioGoncalves> |
LinkedIn<http://www.linkedin.com/in/agoncal>| Paris
JUG <http://www.parisjug.org>