Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Writing to XML file in ejbStore()

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm aware that it's 'Illegal' to access the filesystem through EJBs (File I/O)! But my doubt is, is this NOT possible (throws exception) or does it simply reduces portability?

Is it possible to write to an XML file from an ejbStore() method?

Thanks in advance,
koluwa
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Koluwa,

Welcome to JavaRanch and this forum!

You're right that, among other programming restrictions, the EJB specs state (bottom of page 494):

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.



Now using other APIs than the java.io package may lead you - indirectly - to access the file system anyway.

But the same specs on page 496 lists the APIs that the container must make available to the enterprise bean instances at runtime. And among them you find ... JAXP 1.0!

So I guess that what you need is achievable without breaking any EJB rule.

Regards,

Olivier.
[ August 25, 2004: Message edited by: Olivier Dumont ]
 
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by C. Koluwa:
Hi all,

I'm aware that it's 'Illegal' to access the filesystem through EJBs (File I/O)! But my doubt is, is this NOT possible (throws exception) or does it simply reduces portability?

Is it possible to write to an XML file from an ejbStore() method?

Thanks in advance,
koluwa



Using the IO package is 'legal' but affects portability across EJB 2.0 compliant containers. As regards XML, yes, you can use xml libraries (like DOM) in your ejb methods (it doesn't have to be a specific one). The reason is that DOM and (SAX??) are contained in the JAXP API, which is a guaranteed API for EJB 2.0 compliant servers.
 
Beauty is in the eye of the tiny ad.
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic