org.wamblee.test.jndi
Class JndiProxyFactory<T>

java.lang.Object
  extended by org.wamblee.test.jndi.JndiProxyFactory<T>

public class JndiProxyFactory<T>
extends java.lang.Object

Proxy factory that can provide contextual references to objects retrieved from JNDI. NOTE: This class is probably better suited as a production class, not a test support class. It needs to find a new home in a Java EE production utilities library.

Author:
Erik Brakkee

Nested Class Summary
static class JndiProxyFactory.JndiWiringException
          Exception thrown in case an object cannot be retrieved from JNDI.
 
Constructor Summary
JndiProxyFactory(java.lang.Class<T> aClass, java.lang.String aJndi)
          Constructs the factory.
 
Method Summary
 T getProxy()
          Gets the proxy that delegates to the thread-specific instance set by #set(Object) When at runtime the proxy cannot find lookup the object in JNDI, it throws JndiProxyFactory.JndiWiringException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JndiProxyFactory

public JndiProxyFactory(java.lang.Class<T> aClass,
                        java.lang.String aJndi)
Constructs the factory.

Parameters:
aClass - Interface class of the service to proxy.
aJndi - JNDI name of the object to lookup.
Method Detail

getProxy

public T getProxy()
Gets the proxy that delegates to the thread-specific instance set by #set(Object) When at runtime the proxy cannot find lookup the object in JNDI, it throws JndiProxyFactory.JndiWiringException.

Returns:
Proxy.


Copyright © 2010. All Rights Reserved.