aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes ResourceBundle instead of I/O in EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ResourceBundle instead of I/O in EJB" Watch "ResourceBundle instead of I/O in EJB" New topic
Author

ResourceBundle instead of I/O in EJB

paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20636
    ∞

I know that I/O violates "bean law", but it looks like using the ResourceBundle stuff does not.
Is using ResourceBundle within EJB following bean law?


permaculture Wood Burning Stoves 2.0 - 4-DVD set
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

Actually, the reason listed in the spec is because java.io.* isn't "well-suited" compared to things like JDBC for business data access. Sounds a little murky to me.
If you use the resource bundle manager you wouldn't (directly) be using java.io, but the access is read-only.


Customer surveys are for companies who didn't pay proper attention to begin with.
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
And I guess that there's nothing stopping you from using a JDBC-backed ResourceBundle.
sandy gupta
Ranch Hand

Joined: Jan 30, 2001
Posts: 228
What is JDBC backed ResourceBundle.....First time i am hearing of such a thing and would like to know more :roll:
Simon, Out with all the kitties in that bag


Adios
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Originally posted by sandy ind:
Simon, Out with all the kitties in that bag


Well a ResourceBundle is an abstract class, with concrete implementations including a properties file backed bundle, where the resources are loaded from a properties file. So why not write another concrete implementation that loads the resources from a database?
[seems a little off-topic from J2EE/EJB now!]
Simon
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Originally posted by Tim Holloway:
[QB]Actually, the reason listed in the spec is because java.io.* isn't "well-suited" compared to things like JDBC for business data access. Sounds a little murky to me.
I'm not sure what the wording of the spec is, but I can think of a practical reason for avoiding I/O in EJB. I/O operations can block. Blocking makes threads unrunnable. You aren't managing the threads, the EJB container is. The container won't know what you did (at least not without a lot of introspective effort). Doesn't sound like a great situation for holding a container responsible for managing resources.


Reid - SCJP2 (April 2002)
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ResourceBundle instead of I/O in EJB