JNDI Plug-in
The JNDI plug-in enables both:
To enable embedding OfficeFloor into existing JEE applications, OfficeFloor instances are available under the officefloor name space of the form:
officefloor:<office floor location>
so that an OfficeFloor instance can be obtained via the following example code:
Context context = new InitialContext();
OfficeFloor officeFloor = (OfficeFloor) context.lookup("officefloor:net/example/OfficeFloor.officefloor");The following sources provide means to utilise JNDI objects from within OfficeFloor.
| Source | Description |
|---|---|
| net.officefloor.plugin.jndi.object.JndiObjectManagedObjectSource | To retrieve a JNDI object. |
| net.officefloor.plugin.jndi.work.JndiWorkSource | To utilise a JNDI object's method as a task to execute. This is useful to call methods on an EJB. |
| net.officefloor.plugin.jndi.ldap.JndiLdapManagedObjectSource | To retrieve an LDAP DirContext. |
Typically JEE implementations of JNDI rely on ThreadLocal which limits execution of JEE components to single threads. See the following team source in overcoming this limitation when utilising OfficeFloor within a JEE container:
net.officefloor.frame.impl.spi.team.ProcessContextTeamSource
and in particular the ProcessContextTeam.doWork(...) method.