From 5e450310ba3c3e2dda08313e8f1b7bf96382bd24 Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Sat, 17 Jul 2010 21:36:12 +0000 Subject: [PATCH] --- .../java/org/wamblee/cdi/BeanManagerLookup.java | 12 ++++++------ .../java/org/wamblee/cdi/CdiInjectorFactory.java | 16 +++++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/support/cdi/src/main/java/org/wamblee/cdi/BeanManagerLookup.java b/support/cdi/src/main/java/org/wamblee/cdi/BeanManagerLookup.java index 50bed00a..afa42332 100644 --- a/support/cdi/src/main/java/org/wamblee/cdi/BeanManagerLookup.java +++ b/support/cdi/src/main/java/org/wamblee/cdi/BeanManagerLookup.java @@ -36,7 +36,7 @@ public class BeanManagerLookup { .getLogger(BeanManagerLookup.class.getName()); public static final String BEAN_MANAGER_JNDI = "java:comp/BeanManager"; - private static BeanManager mgr = null; + private static BeanManager BEAN_MANAGER = null; /** * Sets the bean manager (mainly for testability). @@ -45,7 +45,7 @@ public class BeanManagerLookup { * Bean manager. */ public static void setBeanManager(BeanManager aMgr) { - mgr = aMgr; + BEAN_MANAGER = aMgr; } /** @@ -54,16 +54,16 @@ public class BeanManagerLookup { * @return Bean manager. */ public static BeanManager lookup() { - if (mgr == null) { + if (BEAN_MANAGER == null) { try { InitialContext ctx = new InitialContext(); - mgr = (BeanManager) ctx.lookup(BEAN_MANAGER_JNDI); + BEAN_MANAGER = (BeanManager) ctx.lookup(BEAN_MANAGER_JNDI); LOGGER.info("Beanmanager successfully located"); } catch (NamingException e) { LOGGER.warning("No beanmanager was found, using null"); - mgr = null; + BEAN_MANAGER = null; } } - return mgr; + return BEAN_MANAGER; } } diff --git a/support/cdi/src/main/java/org/wamblee/cdi/CdiInjectorFactory.java b/support/cdi/src/main/java/org/wamblee/cdi/CdiInjectorFactory.java index de13ef54..a4e575aa 100644 --- a/support/cdi/src/main/java/org/wamblee/cdi/CdiInjectorFactory.java +++ b/support/cdi/src/main/java/org/wamblee/cdi/CdiInjectorFactory.java @@ -23,8 +23,8 @@ import org.wamblee.inject.Injector; import org.wamblee.inject.InjectorFactory; /** - * Factory that creates CDI injectors. This class may be subclassed for testing to - * override the injectors that are returned. + * Factory that creates CDI injectors. This class may be subclassed for testing + * to override the injectors that are returned. * * @author Erik Brakkee */ @@ -34,11 +34,12 @@ public class CdiInjectorFactory implements InjectorFactory { .getLogger(CdiInjectorFactory.class.getName()); private BeanManager beanManager; - + /** - * Constructs the factory using a default bean manager. + * Constructs the factory using a default bean manager. * - * @throws IllegalArgumentException If bean manager is null. + * @throws IllegalArgumentException + * If bean manager is null. */ public CdiInjectorFactory() { this(BeanManagerLookup.lookup()); @@ -48,10 +49,11 @@ public class CdiInjectorFactory implements InjectorFactory { * Constructs the factory using an explicit bean manager. * * @param aBeanManager - * @throws IllegalArgumentException If bean manager is null. + * @throws IllegalArgumentException + * If bean manager is null. */ public CdiInjectorFactory(BeanManager aBeanManager) { - if ( aBeanManager == null ) { + if (aBeanManager == null) { throw new IllegalArgumentException("Bean manager is null"); } beanManager = aBeanManager; -- 2.31.1