I need to access files from an EJB (I know this is against the EJB spec
but I cannot blob th files and store in a database [for example]- for
various reasons too long to list here). The (gzipped) files are stored
in a directory system off of a root directory. I am thinking of using
JNDI to locate the files, using my own naming system to navigate the
directory structure and then use JMS to send the requested data to the
requestor EJB.
Is this a reasonable (i.e. good) design?. Am I overlooking anything, are
there any pitfalls (gotchas) that I need to be aware of?
Look forward to your responses
MTIA
Alexandr Molochnikov - 11 May 2005 17:38 GMT
Here is one way to circumvent the problem of I/O in EJB:
Servlets are allowed to access the file system. So, you can have all I/O
located in the servlet, and use HTTP to get the file content into your EJ
Bean (through the URL class).
HTH
Alex Molochnikov
Gestalt Corporation
www.gestalt.com
> I need to access files from an EJB (I know this is against the EJB spec
> but I cannot blob th files and store in a database [for example]- for
[quoted text clipped - 10 lines]
>
> MTIA
Frank Langelage - 11 May 2005 20:52 GMT
> I need to access files from an EJB (I know this is against the EJB spec
> but I cannot blob th files and store in a database [for example]- for
> various reasons too long to list here). The (gzipped) files are stored
> in a directory system off of a root directory. I am thinking of using
> ...
I/O is allowed when using an adapter according to JCA spec.
At sourceforge.net you'll find project fileRA for this purpose.
Regrds,
Frank
exquisitus - 11 May 2005 23:02 GMT
Thanks Frank. Interesting article about it on theserverside. My bigges
problem with it (it turns out it was the same for the majority of
correspondents), is the restrictive (GPL) licensing. I will have to rule
it out on that basis alone.
>> I need to access files from an EJB (I know this is against the EJB
>> spec but I cannot blob th files and store in a database [for example]-
[quoted text clipped - 7 lines]
> Regrds,
> Frank
Robert Maas, see http://tinyurl.com/uh3t - 15 Jun 2005 07:30 GMT
> From: exquisitus <nebulla@alpha-centauri.com>
> I need to access files from an EJB (... but I cannot blob th[e] files
> and store in a database ...)
I'm just a newcomer to this, so please knock down this idea if it's not
feasible: Could you set up the file access on a RMI service, and have
the bean get the data via RMI?
John C. Bollinger - 15 Jun 2005 16:21 GMT
>>From: exquisitus <nebulla@alpha-centauri.com>
>>I need to access files from an EJB (... but I cannot blob th[e] files
[quoted text clipped - 3 lines]
> feasible: Could you set up the file access on a RMI service, and have
> the bean get the data via RMI?
It would be non-compliant with the EJB specifications for a bean to
contact an RMI server directly, just like it is non-compliant for a bean
to perform I/O via the java.io or java.nio packages. That doesn't
necessarilly mean that it wouldn't work (in some cases), but it is unwise.

Signature
John Bollinger
jobollin@indiana.edu
Doug Pardee - 16 Jun 2005 04:39 GMT
> It would be non-compliant with the EJB specifications
> for a bean to contact an RMI server directly
Where is that specified?
I not only don't see any prohibition against RMI, I see that the
container is required to have a security policy that will "allow
enterprise beans to use the client functionality of the
Java IDL and RMI-IIOP packages that are part of the Java 2 platform."
(Table 19, Section 24.2.1 of the EJB 2.0 Specification).