ejb@glassfish.java.net

Re: Portable MDB

From: Kenneth Saks <Kenneth.Saks_at_Sun.COM>
Date: Mon, 24 Apr 2006 11:14:15 -0400

Chase wrote:

> I'm trying to make a portable MDB. I can get a MDB work in the style
> done on https://glassfish.dev.java.net/javaee5/ejb/examples/MDB.html.
> A snip of the code on your website:
>
> @MessageDriven(mappedName="MDBQueue")
> public class MDB implements MessageListener {
> ....
> }
>
> After reading the EJB3 spec it doesn't sound like "mappedName" is
> portable(it maps to a global JNDI name).

Hi Chase,

Use of mappedName does not make an application non-portable in the
typical sense. The Java EE platform has always left certain vendor
deployment-environment configuration parameters outside of the spec.
Examples are Remote EJB Global JNDI names, physical MDB queue JNDI
names, physical DataSource JNDI names, etc. These have typically been
set either by vendor-specific configuration files (e.g. SUN's
sun-ejb-jar.xml) or vendor-specific defaults. The key to portability
is that the packaged Java EE modules (.ear, ejb-jar, .war, etc.) have
the same application behavior between vendors. It might be necessary
to add a new vendor-specific .xml file when moving between vendor A and
vendor B but there shouldn't be any *required* change to the application
source or the standard .xml files.

The mappedName was added in Java EE 5 because it turns out almost every
Java EE vendor has a similar approach for mapping some of the most
common logical resources/dependencies to physical resources. Vendors
are not required to support it because there is still no mandated notion
of global JNDI namespace nor any mandated syntax for the mapped names.
However, it doesn't really affect application portability. In the
common case that the vendor does support the mappedName for a particular
resource type, the packaged application will not require any additional
vendor-specific configuration. In the case that it doesn't, the
deployer will need to perform *vendor-specific* configuration, which is
no different than in previous versions of the Java EE platform. A
vendor who doesn't support mappedName must *ignore* it, which is what
allows the deployer to leave the application code and standard .xml
files untouched.

 --ken

> Is there a way to make a portable MDB? And if so can it be done with
> just annotations?
>
> Thanks,
> -Chase
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
>