org.apache.camel.util.jndi
Class CamelSingletonInitialContextFactory

java.lang.Object
  extended by org.apache.camel.util.jndi.CamelInitialContextFactory
      extended by org.apache.camel.util.jndi.CamelSingletonInitialContextFactory
All Implemented Interfaces:
InitialContextFactory

public class CamelSingletonInitialContextFactory
extends CamelInitialContextFactory

A factory of the Camel InitialContext which allows a Map to be used to create a JNDI context.

This implementation is singleton based, by creating a new context once, and reusing it on each call to getInitialContext(java.util.Hashtable).

Version:

Constructor Summary
CamelSingletonInitialContextFactory()
           
 
Method Summary
 Context getInitialContext(Hashtable<?,?> environment)
          Gets or creates the context with the given environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CamelSingletonInitialContextFactory

public CamelSingletonInitialContextFactory()
Method Detail

getInitialContext

public Context getInitialContext(Hashtable<?,?> environment)
                          throws NamingException
Gets or creates the context with the given environment.

This implementation will create the context once, and then return the same instance on multiple calls.

Specified by:
getInitialContext in interface InitialContextFactory
Overrides:
getInitialContext in class CamelInitialContextFactory
Parameters:
environment - the environment, must not be null
Returns:
the created context.
Throws:
NamingException - is thrown if creation failed.


Apache Camel