File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exporting a text file from EJB?

 
Radu Zaharia
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I must export a text file (to a FTP address) from EJB. Since I cannot use the java.io package to first create a text file on the EJB server machine, what should I do?
Thanks,
Radu
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about a POJO or servlet as a client to your EJB to create the text file and save it where you need it?
 
Valentin Tanase
Ranch Hand
Posts: 704
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Radu,

Since I cannot use the java.io package to first create a text file on the EJB server machine, what should I do?

Just one small correction: of course you can. Generally speaking you can do whatever your jvm and the java language will allow you to do. The problem is that this is not a recommended practice, mostly because the EJB container was designed to provide middleware services. From a transactional system point of view, having a business process operating a disc file is not acceptable. The EJB container is not a solution to every software problem, but only to some of them. Can you provide more details about the problem you�re wrestling with?
Regards.
 
Radu Zaharia
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Valentin,

I have to export some data from a database into a text file, on a FTP server. I was first thinking of producing a text file in the EJB Container and then FTP it on the FTP server. But now I think I could read the data from the database and then append it directly in the file on the FTP server, without producing an intermediary text file. Would this be OK?

Thanks,
Radu
 
Valentin Tanase
Ranch Hand
Posts: 704
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Radu,

Just my thoughts. From a technical point of view, yes it might be ok. It might work and the data will be transferred to the destination via FTP. On the other hand, from a designing point of view it might not. The problem you�re solving looks mostly like a batch process than a business use case. Your task could be implemented without the need of any web server or ejb container. How about a simple java application? Ultimately you can write a shell script and schedule a cron job if your task needs to run periodically. Is there any particular reason enforcing your task to run within the EJB container?
Regards.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic