JNDI Plug-in

The JNDI plug-in enables both:

'officefloor' JNDI Name Space

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");

Using JNDI within OfficeFloor

The following sources provide means to utilise JNDI objects from within OfficeFloor.

SourceDescription
net.officefloor.plugin.jndi.object.JndiObjectManagedObjectSourceTo retrieve a JNDI object.
net.officefloor.plugin.jndi.work.JndiWorkSourceTo 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.JndiLdapManagedObjectSourceTo retrieve an LDAP DirContext.

Thread context expectations of JNDI within JEE containers

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.