[jboss-dev-forums] [Design of EJB 3.0] - Decoupling from MC
ALRubinger
do-not-reply at jboss.com
Sun May 25 00:48:24 EDT 2008
See http://jira.jboss.com/jira/browse/EJBTHREE-1379 and linked Forum reference.
I've added in EJB3 Common an "EJB3 Registrar SPI" along with an MC-based implementation; this allows us to:
* Globally access the Object Store and invoke upon it in a convenient fashion, regardless of whether you're in a managed context or not
* Decouple EJB3 from being MC-aware (for when we realize that MC sucks and Spring is totally the way to go)
In practice, it'll be the responsibility of the runtime (ie. AS Deployers, Unit Tests, etc) to call "Ejb3RegistrarLocator.bindRegistrar" and pass in a Registrar implementation (currently I've made the MC one, a small, simple facade).
For example, a Unit Test may do:
// Unit Tests, as the runtime, are allowed to know about MC, but the coupling ends there
| @BeforeClass
| public static void beforeClass() throws Throwable
| {
| // Bind the Ejb3Registrar
| Ejb3RegistrarLocator.bindRegistrar(new Ejb3McRegistrar(getKernel()));
| }
...and then anything in the process may use MC (transparently) like:
// Bind Example
| Ejb3RegistrarLocator.locateRegistrar().bind("beanBindName",myObject);
|
| // Lookup Example
| Object myObject2 = Ejb3RegistrarLocator.locateRegistrar().lookup("beanBindName");
So the dependency on MC from EJB3 Proxy, for example, is now removed.
Sources:
http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/common/src/main/java/org/jboss/ejb3/common/registrar/
S,
ALR
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153185#4153185
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153185
More information about the jboss-dev-forums
mailing list