On Mar 11, 2009, at 12:56 PM, Karan Malhi wrote:

Awesome,

This feature could pretty much make it into the spec as is !! . Very cool !

Definitely. We went with the new class over the InitialContext as it gives us the ability to add methods and functionality in future specs. Always a nice door to leave open.


-David

On Wed, Mar 11, 2009 at 3:26 PM, David Blevins <[email protected]>wrote:

The JSR #318 Expert Group has put another Proposed Final Draft (PFD) up for
download:

Enterprise JavaBeans 3.1

http://jcp.org/aboutJava/communityprocess/pfd/jsr318/index.html

Note this is still a draft and no the final spec.

Have a look at chapter 22 and see if anything feels familiar.

Essentially this:

  Properties p = new Properties();
  p.put("java.naming.factory.initial",
"org.apache.openejb.client.LocalInitialContextFactory");
  p.put("movieDatabase", "new://Resource?type=DataSource");
  p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
  p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");

  p.put("movieDatabaseUnmanaged", "new://Resource?type=DataSource");
p.put("movieDatabaseUnmanaged.JdbcDriver", "org.hsqldb.jdbcDriver");
  p.put("movieDatabaseUnmanaged.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
  p.put("movieDatabaseUnmanaged.JtaManaged", "false");

  Context context = new InitialContext(p);

  Movies movies = (Movies) context.lookup("MoviesLocal");

Becomes this:

  Properties p = new Properties();
  p.put("javax.ejb.embeddable.initial",
"org.apache.openejb.client.LocalInitialContextFactory");
  p.put("movieDatabase", "new://Resource?type=DataSource");
  p.put("movieDatabase.JdbcDriver", "org.hsqldb.jdbcDriver");
  p.put("movieDatabase.JdbcUrl", "jdbc:hsqldb:mem:moviedb");

  p.put("movieDatabaseUnmanaged", "new://Resource?type=DataSource");
p.put("movieDatabaseUnmanaged.JdbcDriver", "org.hsqldb.jdbcDriver");
  p.put("movieDatabaseUnmanaged.JdbcUrl", "jdbc:hsqldb:mem:moviedb");
  p.put("movieDatabaseUnmanaged.JtaManaged", "false");

  EJBContainer container = EJBContainer.createEJBContainer(p);

  Context context = container.getContext();

  Movies movies = (Movies) context.lookup("MoviesLocal");


-David




--
Karan Singh Malhi

Reply via email to