• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Programming restrictions

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My understanding of programming restrictions is that reading or writing to a file is not portable across EJB2 compliant servers. This makes it very difficult to use XML configuation files either of your own for complex business logic (where env-entries are not suffuciently complex) or for the use of something like jakarta commons-validator framework where you would have to write

InputStream in = getClass().getResourceAsStream("validator.xml");

to get the validation rules.

Is this programming restriction definitive and does anyone have any thoughts on it.

Thanks

Peter
 
Peter Warde
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Further to what I wrote above, I have just looked at the spec 24.1.2 on programming restrictions. It says:

"An enterprise bean must not use java.io package to attempt to access files and directories in the file system"

The reason it gives is that "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."

Does this mean that it is ok to read any XML files such as the one mentioned bundled in the ear archive in the container? After all the container reads the ejb-jar.xml file.

Can anyone comment? Thanks.
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

The use of I/O within the business logic of the Enterprise Java Bean

is not advisable

Say for example if you want to form a jar file on the fly and publish the
information to a file and store it in a file system...then it is better
to go for Servlets.


But in certain cases...were you are developing components for a major
system, where it is deployed in multiple location.Definetly we have to
maintain...different configuration...like Report Server, Security Certs...
and many other things.In that case we can use a separate XML and
use parser to parse the information.



Regards
-Parsuvanath.
 
Surfs up space ponies, I'm making gravy without this lumpy, tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic