Firstly, note that the OS-specific particulars of file I/O and networking
are handled by the JVM, which is a C program ported to each platform it runs
on.  So that has nothing to do with why EJBs are restricted in these
domains.

The section of the EJB spec you should refer to is 18.2.1, namely Table
18-1.  The reason for the restrictions is stated in that section:

"to protect the security and integrity of the EJB container environment, and
to prevent the [EJBs} from interfering with the container's functions."

Note also (same section) that vendors can grant more or less permissions to
beans, but this is outside the spec and so relying on more or less
permissions could reduce your bean's portability across containers.

Scott Stirling
Allaire Corporation
http://www.allaire.com/developer/jrunreferencedesk/

> -----Original Message-----
> From: Nicholas Whitehead [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 07, 2000 1:19 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [EJB-INT] Socket in Entity Bean
>
>
> I hear these nebulous references to the EJB spec all
> the time so I yanked it up to really read it.
>
> I assert that there is no actual prohibition against
> socket or java.io file usage in enterprise beans. The
> recommendation against these activities is listed in a
> section that commences thus:
>
> "This section describes the programming restrictions
> that a Bean Provider must follow to ensure that the
> enterprise bean is portable and can be deployed in any
> compliant EJB Container."
>
> So I interpret this to mean that if you DO use java.io
> files or sockets in any way in your EJBs, you may be
> threataning the PORTABILITY of your beans. This is
> because of significant differences in the way that the
> OS implement these operations.
>
> //Nicholas
>
> --- Bo Xu <[EMAIL PROTECTED]> wrote:
> > Hi ,
> >
> > From the document of EJB, I also find that:
> > 1. can not use "ServerSocket"
> > 2. can not use "java.io" to access a file.
> > ....
> >
> > But :
> > 1. from jps1.0.1,  it need to modify the
> > j2sdk1.2.1\lib\security\server.policy,
> > and
> >     grant the following:
> >    permission java.io.FilePermission "??ALL
> > FILES>>","read, write,delete";
> >
> > 2. And after I grant such "Permission", my session
> > bean can access local files.
> >
> >
> > So :
> > 1. Can we grant some "Permission" to "ServerSocket"?
> > 2. If we can grant such "Permission" , how to
> > explain the document
> >     of EJB?  Does the document  means that it is not
> > "robust" if we grant such
> >     "Permission"?   Because now I don't have a
> > "Object database" to use, so
> >    sometimes it is not convenient to "divide" my
> > class, so I need to save the
> > class
> >    into a file.
> >
> >
> > Thanks for your time!
> >
> > Bo
> > July 07,2000
> >
> >
> > yu_robin wrote:
> >
> > > Hi,
> > >         but I must communicate with a server
> > application that lies in an
> > > another machine, the server application is a
> > intrinsic part, and it only has
> > > the socket interface, I cannot modify it. In my
> > project, a part of my date
> > > lies in a database, but another part lies in a
> > close environment that must
> > > be accessed through that server application. So I
> > must access some through
> > > entity bean and some through sockets. For hiding
> > the difference of  the two
> > > ways of accessing data, I want to write sockets in
> > my entity beans also. And
> > > I need not take care of transaction, because the
> > socket server application
> > > can do it automatically.
> > >
> > > ++++++++++++++++++++++++++++
> > > Shanghai Huateng Software Systems Co., Ltd.
> > > 418 Gui Lin Road
> > > Shanghai, P.R.China 200233
> > > Tel     : +86-21-6451-3533-11
> > > Fax     : +86-21-6472-8625
> > > E-mail  : [EMAIL PROTECTED]
> > > Web     : http://www.huateng.com
> > >           http://www.chinapay.com
> > >
> > > ? ----------
> > > ? From:         Jonas
> > Wallenius[SMTP:[EMAIL PROTECTED]]
> > > ? Reply To:     A mailing list for Enterprise
> > JavaBeans development
> > > ? Sent:         Friday, July 7, 2000 5:40 PM
> > > ? To:   [EMAIL PROTECTED]
> > > ? Subject:      Re: Socket in Entity Bean
> > > ?
> > > ? Afaik you _could_, but it wouldn't be
> > transactional (not a problem for
> > > ? read-only operations I suppose), you expose
> > yourself to more potential
> > > ? exception sources (=higher risk your bean might
> > mess up transactions it
> > > ? partakes in unless the network the socket call
> > is made over can be
> > > ? considered
> > > ? reliable), and I guess there might be potential
> > problems if the remote end
> > > ? blocks for a long time or so... It shouldn't be
> > too hard to put together a
> > > ? very
> > > ? simple test environment to find out, though?
> > > ?
> > > ? /Jonas
> > > ?
> > > ? On Fri, 7 Jul 2000, yu_robin wrote:
> > > ?
> > > ? ? Hi canals,
> > > ? ?         Yes, I want to make an ejb that acts
> > as a client using sockets,
> > > ? I
> > > ? ? know that I can write client sockets in my
> > ejbs but not server sockets,
> > > ? but
> > > ? ? the problem is that whether I can implement
> > the ejb's ejbCreate(),
> > > ? ? ejbRemove(), ejbStore() and other methods
> > through my client sockets
> > > ? sending
> > > ? ? data to and receiving data from a remote
> > server socket, just as
> > > ? connecting
> > > ? ? to a database connection pool and make some
> > sql operation.
> > > ? ?
> > > ? ? thanks.
> > > ? ?
> > > ? ?
> > > ? ? ++++++++++++++++++++++++++++
> > > ? ? Shanghai Huateng Software Systems Co., Ltd.
> > > ? ? 418 Gui Lin Road
> > > ? ? Shanghai, P.R.China 200233
> > > ? ? Tel     : +86-21-6451-3533-11
> > > ? ? Fax     : +86-21-6472-8625
> > > ? ? E-mail  : [EMAIL PROTECTED]
> > > ? ? Web     : http://www.huateng.com
> > > ? ?           http://www.chinapay.com
> > > ? ?
> > > ? ? ? ----------
> > > ? ? ? From:         Luis F.
> > Canals[SMTP:[EMAIL PROTECTED]]
> > > ? ? ? Reply To:     A mailing list for Enterprise
> > JavaBeans development
> > > ? ? ? Sent:         Friday, July 7, 2000 2:45 PM
> > > ? ? ? To:   [EMAIL PROTECTED]
> > > ? ? ? Subject:      Re: Socket in Entity Bean
> > > ? ? ?
> > > ? ? ? Hello Robin,
> > > ? ? ?         If you want to listen (like a
> > server) on a socket, you can't
> > > ? do it
> > > ? ? ? whit
> > > ? ? ? EJB (see Enterprise JavaBeans Specification,
> > chap. 18, sec. 18.1.2.
> > > ? -you
> > > ? ? ? can
> > > ? ? ? download from
> > http://java.sun.com/products/ejb/docs.html). If you
> > want
> > > ? to
> > > ? ? ? make an EJB that acts as a client using
> > sokects (I think this is
> > > ? you're
> > > ? ? ? trying, don't you?), the specification
> > permits you.
> > > ? ? ?
> > > ? ? ?         Regards.
> > > ? ? ?
> > > ? ? ? Luis F. Canals Samaniego
> > > ? ? ? CEDETEL
> > > ? ? ? Parque Tecnol??(r)gico de Boecillo
> > > ? ? ? Edificio Centro, Parcela 109
> > > ? ? ? E-47151 Boecillo (Valladolid)
> > > ? ? ? SPAIN
> > > ? ? ?
> > > ? ? ? Tfno: +34 983 54 65 02
> > > ? ? ? Fax:  +34 983 54 66 96
> > > ? ? ?
> > > ? ? ?
> > > ? ? ? -----Mensaje original-----
> > > ? ? ? De: A mailing list for Enterprise JavaBeans
> > development
> > > ? ? ? [mailto:[EMAIL PROTECTED]]En nombre
> > de yu_robin
> > > ? ? ? Enviado el: viernes 7 de julio de 2000 8:05
> > > ? ? ? Para: [EMAIL PROTECTED]
> > > ? ? ? Asunto: Socket in Entity Bean
> > > ? ? ?
> > > ? ? ?
> > > ? ? ? Hi everyone,
> > > ? ? ?   I have some data that must be fetched from
> > a remote host through
> > > ? socket,
> > > ? ? ? and some others from a db.  I want to hide
> > the difference between
> > > ? these
> > > ? ? ? two
> > > ? ? ? ways of getting data upon the entity bean
> > layer??? then session beans
> > > ? can
> > > ? ? ? get
> > > ? ? ? data through entity beans uniformly. Can I
> > write socket in my bean
> > > ? managed
> > > ? ? ? entity beans?
> > > ? ? ? pls help me.
> > > ? ? ? thanks.
> > > ? ? ?
> > > ? ? ? robin
> >
> === message truncated ===
>
>
> =====
>
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.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".
>

===========================================================================
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".

Reply via email to