According to EJB 1.1 specification, a container or bean provider SHOULD
not allow IO operations in order to keep the beans portable to other
containers/servers. But this does not prohibit any body from
writing/allowing such operations. The outcome is that the bean will be
server(in this case J2EE) specific.
I my view such restrictions should either be made mandatory or be removed
totally from specifications. Such should/ Should not restriction may result
in more of server/container specific codes ( if we are interested in that,
at all).
-Anurag
>From: Marc-Oliver Scheele <[EMAIL PROTECTED]>
>Reply-To: A mailing list for Enterprise JavaBeans development
><[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: No I/O restriction in suns J2EE
>Date: Mon, 28 Feb 2000 12:44:37 +0100
>
>Hello;
>
>I thought the EJB 1.1 prohibited file access via java.io.*.
>
>I tested it against the sun's J2EE, because they have
>fully implemented EJB 1.1.
>
>And what a surprise:
>There are no restrictions for I/O!
>
>Here is the code I used in my bean:
>
>import javax.ejb.*;
>import java.io.*;
>public class AdderEJB implements SessionBean
>{
>
> int total;
>
> public void ejbCreate() {
> total = 0;
> }
>
> public void ejbCreate(int initial) {
> total = initial;
> }
>
> public void add(int number) {
> total += number;
> try {
> File file= new java.io.File("c:/temp/newww.txt");
> FileWriter writer = new FileWriter(file);
> writer.write("Hallo dies ist eine I/O-Operation mit EJB");
> writer.close();
> } catch (Exception exc) {
> System.out.println("Konnte nicht schreiben---- ");
> exc.printStackTrace();
> }
> }
>
> public int getTotal() {
> return total;
> }
>
> public AdderEJB() {}
> public void setSessionContext(SessionContext sc) {}
> public void ejbRemove() {}
> public void ejbActivate() {}
> public void ejbPassivate() {}
>
>} // AdderEJB
>
>
>Greetings
>Oliver
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff EJB-INTEREST". For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".